feat(Infini-WSL): add host for Windows Subsystem For Linux

This commit is contained in:
Infinidoge 2022-04-27 21:10:17 -04:00
parent 0b1a8cbe9a
commit 8bb0369c1c
5 changed files with 99 additions and 3 deletions

69
flake.lock generated
View file

@ -1202,6 +1202,22 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1648199409,
"narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "64a525ee38886ab9028e6f61790de0832aa3ef03",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1631561581, "lastModified": 1631561581,
@ -1251,6 +1267,21 @@
} }
}, },
"flake-utils_3": { "flake-utils_3": {
"locked": {
"lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"locked": { "locked": {
"lastModified": 1644229661, "lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
@ -1282,7 +1313,7 @@
}, },
"fup": { "fup": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_3" "flake-utils": "flake-utils_4"
}, },
"locked": { "locked": {
"lastModified": 1647259887, "lastModified": 1647259887,
@ -1494,6 +1525,26 @@
"type": "github" "type": "github"
} }
}, },
"nixos-wsl": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1650629047,
"narHash": "sha256-IwiKbzXTzodPKMHm5qTizGoMVjipevbliraFmnrdsqU=",
"owner": "nix-community",
"repo": "NixOS-WSL",
"rev": "69783cf56b2ada7e0e8cc8d17907a346e8bd97b7",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NixOS-WSL",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1633971123, "lastModified": 1633971123,
@ -1540,6 +1591,21 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_3": {
"locked": {
"lastModified": 1649944829,
"narHash": "sha256-wjOgLfjCdyoRamMOrVJceeDJk4LvJsQOxBoT3k16/7Q=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2f06b87f64bc06229e05045853e0876666e1b023",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-21.11",
"type": "indirect"
}
},
"poetry2nix": { "poetry2nix": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
@ -1720,6 +1786,7 @@
"nix-minecraft": "nix-minecraft", "nix-minecraft": "nix-minecraft",
"nixos": "nixos", "nixos": "nixos",
"nixos-hardware": "nixos-hardware_2", "nixos-hardware": "nixos-hardware_2",
"nixos-wsl": "nixos-wsl",
"powercord-setup": "powercord-setup", "powercord-setup": "powercord-setup",
"quick-nix-registry": "quick-nix-registry", "quick-nix-registry": "quick-nix-registry",
"stable": "stable" "stable": "stable"

View file

@ -41,6 +41,8 @@
quick-nix-registry.url = "github:divnix/quick-nix-registry"; quick-nix-registry.url = "github:divnix/quick-nix-registry";
nixos-wsl.url = "github:nix-community/NixOS-WSL";
# --- Application-Specific Flake Inputs # --- Application-Specific Flake Inputs
# # --- Powercord # # --- Powercord
powercord-setup.url = "path:/etc/nixos/subflakes/powercord"; powercord-setup.url = "path:/etc/nixos/subflakes/powercord";
@ -115,6 +117,7 @@
./secrets ./secrets
# --- Library Modules --- # --- Library Modules ---
inputs.nixos-wsl.nixosModules.wsl
inputs.impermanence.nixosModules.impermanence inputs.impermanence.nixosModules.impermanence
inputs.quick-nix-registry.nixosModules.local-registry inputs.quick-nix-registry.nixosModules.local-registry

View file

@ -0,0 +1,26 @@
{ suites, profiles, pkgs, lib, ... }: {
imports = lib.lists.flatten [
(with suites; [
base
develop
])
];
system.stateVersion = "22.05";
# I don't use Windows, but when I do, I want NixOS there with me,
wsl = {
enable = true;
automountPath = "/media";
defaultUser = "infinidoge";
startMenuLaunchers = true;
};
# No host keys -> No decrypted files -> No password files
modules.secrets.enable = false;
# This host is only used on WSL on a computer with a strong password already, and agenix is wonky with WSL.
# Public hash and duplicate password is good enough
user.hashedPassword = "$6$SDBGTp1hVS7eOs3P$uJwwxOUxrRaMTAPdc349vvSfA7u.4SHtJuXvxxIo4v70WT9KQqmbOOF5qWS9/.okv.HkcBe0CVj5fLaPy9Oew.";
users.users.root.hashedPassword = "$6$SDBGTp1hVS7eOs3P$uJwwxOUxrRaMTAPdc349vvSfA7u.4SHtJuXvxxIo4v70WT9KQqmbOOF5qWS9/.okv.HkcBe0CVj5fLaPy9Oew.";
}

View file

@ -19,7 +19,7 @@ in
{ {
assertions = [ assertions = [
{ {
assertion = (count (v: v) [ cfg.grub.enable cfg.systemd-boot.enable ]) == 1; assertion = (count (v: v) [ cfg.grub.enable cfg.systemd-boot.enable config.wsl.enable ]) == 1;
message = "Must enable one and only one bootloader"; message = "Must enable one and only one bootloader";
} }
]; ];

View file

@ -7,7 +7,7 @@ let
secrets = lib.mapAttrs' (n: v: lib.nameValuePair (lib.removeSuffix ".age" n) { file = toFile n; }) filtered; secrets = lib.mapAttrs' (n: v: lib.nameValuePair (lib.removeSuffix ".age" n) { file = toFile n; }) filtered;
in in
{ {
options.modules.secrets.enable = lib.mkOpt lib.types.bool true; options.modules.secrets.enable = lib.hlissner.mkOpt lib.types.bool true;
config.age.secrets = lib.mkIf config.modules.secrets.enable secrets; config.age.secrets = lib.mkIf config.modules.secrets.enable secrets;
} }