Nix Flakes configuration for MacOS, NixOS and WSL
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

wip: custom lib

+54 -21
+11 -3
README.md
··· 61 61 . 62 62 ├── homes # User home configuration 63 63 │ ├── _shared # Shared dotfiles between user configuration 64 - │ │ └── <system> 65 - │ │ │ └── <hostname> 66 - │ │ │ │ └── <username> # User host specific dotfiles 64 + │ │ └── <username> 65 + │ └── <system> 66 + │ │ └── <hostname> 67 + │ │ │ └── <username> # User host specific dotfiles 67 68 ├── hosts # Host-specific configuration 68 69 │ └── <system> 69 70 │ │ └── <hostname> ··· 96 97 - [elythh](https://github.com/elythh/flake) 97 98 - [chenglab](https://github.com/eh8/chenglab) 98 99 - [AlexNabokikh](https://github.com/AlexNabokikh/nix-config) 100 + 101 + ## Troubleshooting 102 + 103 + - If the rebuild command failed because an experimental feature is disabled use this command 104 + ```sh 105 + sudo -E NIX_CONFIG="experimental-features = nix-command flakes pipe-operators" nixos-rebuild switch --flake . 106 + ```
+8 -3
flake.nix
··· 20 20 zen-browser.url = "github:0xc000022070/zen-browser-flake"; 21 21 }; 22 22 23 + nixConfig = { 24 + experimental-features = "nix-command flakes pipe-operators"; 25 + auto-optimise-store = true; 26 + }; 27 + 23 28 outputs = { self, nixpkgs, darwin, ... }@inputs: 24 29 let inherit (self) outputs; lib = import ./lib { inherit self inputs; }; in 25 30 { overlays = import ./overlays { inherit inputs outputs; }; } 26 - // (lib.host.mkHosts); 31 + # // (lib.host.mkHosts); 27 32 28 - # // (lib.host.mkHost { system = "x86_64-linux"; hostname = "loki"; path = ./hosts/x86_64-linux/loki/default.nix; }) 29 - # // (lib.host.mkHost { system = "aarch64-darwin"; hostname = "njord"; path = ./hosts/aarch64-darwin/njord/default.nix; }); 33 + // (lib.host.mkHost { system = "x86_64-linux"; hostname = "loki"; path = ./hosts/x86_64-linux/loki/default.nix; }) 34 + // (lib.host.mkHost { system = "aarch64-darwin"; hostname = "njord"; path = ./hosts/aarch64-darwin/njord/default.nix; }); 30 35 }
+5 -2
hosts/x86_64-linux/loki/default.nix
··· 2 2 { 3 3 imports = [ 4 4 ./hardware.nix 5 - # ./../../../modules/nixos/services/window-managers/river 6 5 inputs.home-manager.nixosModules.home-manager 7 6 ]; 8 7 ··· 125 124 }; 126 125 127 126 # Add extra groups to users 128 - users.users.cosmeak.extraGroups = [ "networkmanager" "wheel" ]; 127 + users.users.cosmeak = { 128 + isNormalUser = true; 129 + description = "cosmeak"; 130 + extraGroups = [ "networkmanager" "wheel" ]; 131 + }; 129 132 130 133 # Enable or not CUPS to print documents. 131 134 services.printing.enable = false;
+30 -13
lib/default.nix
··· 119 119 ## Create all available hosts 120 120 #@ Attrs -> Attrs 121 121 mkHosts = let 122 - systems = fs.getDirectories ./../hosts; 123 - hostsInformations = lib.concatMap (systemPath: getSystemHostsInformations systemPath) systems; 124 - generateHosts = infos: lib.foldl (acc: info: acc // host.mkHost info) {} infos; 125 - in generateHosts hostsInformations; 122 + architecturesPath = ./../hosts; 123 + # Get the architecture directories 124 + architectures = fs.getDirectories architecturesPath; 125 + 126 + # Collect all hosts by iterating over architectures 127 + allHosts = lib.map (architecture: let 128 + # Get host directories for this architecture 129 + hostDirectories = fs.getDirectories "${architecturesPath}/${architecture}"; 130 + 131 + # Generate the host information for each directory 132 + hostInfos = lib.map (hostDir: getSystemHostsInformations hostDir) hostDirectories; 133 + 134 + # Create a host configuration for each host information 135 + hostConfigs = lib.map (hostInfo: mkHost { 136 + system = hostInfo.system; # The system (architecture) for the host 137 + hostname = hostInfo.hostname; 138 + path = hostInfo.path; 139 + }) hostInfos; 140 + in hostConfigs) architectures; 141 + in lib.foldl' (attrs: newAttrs: attrs // newAttrs) {} allHosts; 126 142 }; 127 143 128 144 ## Home ··· 150 166 home.stateVersion = stateVersion; 151 167 }; 152 168 } 153 - (if system |> host.isLinux then { 154 - # Define a user account. Don't forget to set a password with ‘passwd’. 155 - users.users.${username} = { 156 - isNormalUser = true; 157 - description = username; 158 - extraGroups = [ ]; 159 - }; 160 - } else {}) 169 + # (if system |> host.isLinux then { 170 + # # Define a user account. Don't forget to set a password with ‘passwd’. 171 + # users.users.${username} = { 172 + # isNormalUser = true; 173 + # description = username; 174 + # extraGroups = [ ]; 175 + # }; 176 + # } else {}) 161 177 ]; 162 178 163 179 ## Create all user home from a host ··· 171 187 }; 172 188 173 189 ## Flake output 174 - ## Help manage flake output creation 190 + ## Help manage flake output creation with making available the lib, 191 + ## modules, overlays and configurations. 175 192 flake = rec { 176 193 ## Build flake output 177 194 mkFlake = {};