Created
November 11, 2025 08:58
-
-
Save haylinmoore/5d253c91df849c013ffdf2fe19e72583 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let | |
| pkgs = import <nixpkgs> { }; | |
| lib = pkgs.lib; | |
| targetFS = | |
| { targetFSes }: | |
| pkgs.symlinkJoin { | |
| name = "fs"; | |
| paths = targetFSes; | |
| }; | |
| passwd = | |
| { users }: | |
| let | |
| concatMapStrings = lib.strings.concatMapStrings; | |
| combiner = (x: x + ":x:0:0::/home/${x}:/run/current-system-/sw/bin/bash\n"); | |
| content = concatMapStrings combiner users; | |
| in | |
| pkgs.stdenv.mkDerivation { | |
| pname = "passwd"; | |
| name = "passwd"; | |
| phases = [ "installPhase" ]; | |
| installPhase = '' | |
| mkdir -p $out/etc/ | |
| cat <<EOF > $out/etc/passwd | |
| ${content}''; | |
| }; | |
| infuse = (import ./lib/infuse.nix { inherit lib; }).v1.infuse; | |
| in | |
| lib.fix ( | |
| final: | |
| infuse { } [ | |
| { | |
| fs.__assign = pkgs.callPackage targetFS { | |
| targetFSes = [ ]; | |
| }; | |
| } | |
| { | |
| passwd.__assign = pkgs.callPackage passwd { | |
| users = [ | |
| "root" | |
| "toor" | |
| ]; | |
| }; | |
| fs.__input.targetFSes.__append = [ final.passwd ]; | |
| } | |
| { | |
| passwd.__input.users.__append = [ "haylin" ]; | |
| } | |
| ] | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| root:x:0:0::/home/root:/run/current-system-/sw/bin/bash | |
| toor:x:0:0::/home/toor:/run/current-system-/sw/bin/bash | |
| haylin:x:0:0::/home/haylin:/run/current-system-/sw/bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment