NixOS configuration 🪄

✨🚧 added structure for 'apple' system

Signed-off-by: Xaiya Schumin <d.schumin@proton.me>

+54 -25
-18
1
··· 1 - { lib, ... }: 2 - let 3 - inherit (builtins) 4 - fromTOML 5 - readFile 6 - in 7 - { 8 - programs.starship = { 9 - enable = true; 10 - 11 - settings = fromTOML ( 12 - readFile (fetchurl { 13 - url = "https://starship.rs/presets/toml/bracketed-segments.toml"; 14 - sha256 = "sha256-FQHzfWYEcllLCmH2nx52J31Jw8Yy6aDAoOVdxWxhcAU="; # TODO: make this auto update? (versioned) 15 - }) 16 - ); 17 - }; 18 - }
+6 -3
modules/nixos/hardware/networking/ssh.nix
··· 1 - { config, self, ... }: 1 + { config, self, lib, ... }: 2 + let 3 + inherit (lib) mkIf; 4 + in 2 5 { 3 6 services.openssh = { 4 7 enable = true; ··· 16 19 }; 17 20 18 21 # Load ssh keys 19 - age.secrets = { 22 + age.secrets = (mkIf config.sylveon.profiles.development.enable { 20 23 "ssh-gh" = { 21 24 # Github 22 25 rekeyFile = "${self}/secrets/ssh-gh.age"; ··· 38 41 group = "users"; 39 42 }; 40 43 41 - }; 44 + }); 42 45 }
+10 -4
modules/nixos/users.nix
··· 8 8 let 9 9 inherit (lib.types) listOf str; 10 10 inherit (lib.attrsets) genAttrs; 11 - inherit (lib) forEach; 11 + inherit (lib) forEach mkIf; 12 12 13 13 inherit (self.lib.modules) mkOpt; 14 14 inherit (self.lib.validation) hasHomeModule; ··· 20 20 21 21 config = { 22 22 # Generate random passwords for users 23 - age.secrets = genAttrs (forEach users (name: "${name}-passwd")) (name: { 23 + age.secrets = (mkIf (!config.sylveon.profiles.server.enable) (genAttrs (forEach users (name: "${name}-passwd")) (name: { 24 24 rekeyFile = "${self}/secrets/${name}.age"; 25 25 generator.script = "sha256"; 26 - }); 26 + }))); 27 27 28 28 # Create users from list 29 29 users.users = genAttrs users ( 30 30 name: 31 31 { 32 - hashedPasswordFile = config.age.secrets."${name}-passwd".path; 32 + hashedPasswordFile = 33 + if config.age.secrets."${name}-passwd" 34 + then config.age.secrets."${name}-passwd".path 35 + else null; 36 + 37 + initialPassword = "password123"; 38 + 33 39 isNormalUser = true; 34 40 shell = config.home-manager.users.${name}.programs.zsh.package; # This might change if introducing multiple shells 35 41
+35
systems/apple/default.nix
··· 1 + { 2 + pkgs, 3 + inputs, 4 + config, 5 + ... 6 + }: 7 + { 8 + imports = [ 9 + # ./fileSystem.nix TODO 10 + ]; 11 + 12 + networking.hostName = "apple"; 13 + 14 + sylveon = { 15 + profiles.server.enable = true; 16 + 17 + device.cpu = "intel"; 18 + 19 + system = { 20 + users = [ "semiko" ]; 21 + }; 22 + 23 + services = { 24 + # General services 25 + postgres.enable = true; 26 + 27 + # school task 28 + # nextcloud.enable = true; 29 + 30 + }; 31 + }; 32 + 33 + nixpkgs.hostPlatform = "x86_64-linux"; 34 + system.stateVersion = "25.05"; 35 + }
+3
systems/default.nix
··· 17 17 18 18 # Home server 19 19 apricot = { }; 20 + 21 + # school system 22 + apple = { }; 20 23 }; 21 24 }; 22 25 }