Reproducible dotfiles in nix
at main 67 lines 2.3 kB view raw
1{inputs}: let 2 defaultUsername = "ethan"; 3in { 4 mkStandalone = {userName ? defaultUsername}: {system}: 5 inputs.home-manager.lib.homeManagerConfiguration { 6 pkgs = inputs.nixpkgs; 7 modules = [ 8 # (import ./shared/home.nix {inherit inputs pkgs-stable;}) 9 # ./shared/lsp.nix 10 # (import ./shared/python.nix {inherit pkgs-stable;}) 11 ./shared/nix.nix 12 ]; 13 # modules = [./home.nix ./lsp.nix ./ocaml.nix ./python.nix]; 14 extraSpecialArgs = { 15 inherit inputs; 16 pkgs = inputs.nixpkgs; 17 }; 18 }; 19 mkDarwin = {userName ? defaultUsername}: {system}: 20 inputs.nix-darwin.lib.darwinSystem { 21 inherit system; 22 modules = [ 23 { 24 # Manage using determinate Nix instead 25 nix.enable = false; 26 27 nixpkgs.config.allowUnfree = true; 28 environment.etc."determinate/config.json".text = '' 29 { 30 "authentication": { 31 "additionalNetrcSources": [ 32 "/Users/ethan/.config/nix/netrc" 33 ] 34 } 35 } 36 ''; 37 38 # Create /etc/zshrc that loads the nix-darwin environment. 39 programs.zsh.enable = true; # default shell on catalina 40 programs.fish.enable = true; 41 system.stateVersion = 4; 42 43 # The platform the configuration will be used on. 44 nixpkgs.hostPlatform = "aarch64-darwin"; 45 users.users.${userName}.home = "/Users/${userName}"; 46 determinate-nix.customSettings = { 47 trusted-users = ["root" "${userName}"]; 48 }; 49 } 50 inputs.determinate.darwinModules.default 51 inputs.home-manager.darwinModules.home-manager 52 { 53 home-manager.useGlobalPkgs = true; 54 home-manager.useUserPackages = true; 55 home-manager.users.${userName} = {pkgs, ...}: { 56 imports = [ 57 # inputs.ghostty.homeModules.default 58 (import ./shared/home.nix {inherit inputs pkgs userName;}) 59 (import ./shared/lsp.nix {inherit inputs pkgs;}) 60 (import ./shared/python.nix {inherit inputs pkgs;}) 61 (import ./shared/nix.nix {inherit inputs pkgs;}) 62 ]; 63 }; 64 } 65 ]; 66 }; 67}