diff options
Diffstat (limited to 'nix')
-rw-r--r-- | nix/disko/nvme-simple.nix (renamed from nix/modules/nvme-simple.nix) | 0 | ||||
-rw-r--r-- | nix/disko/sda-simple.nix (renamed from nix/modules/sda-simple.nix) | 0 | ||||
-rw-r--r-- | nix/disko/vda-simple.nix (renamed from nix/modules/vda-simple.nix) | 0 | ||||
-rw-r--r-- | nix/flake.lock | 143 | ||||
-rw-r--r-- | nix/flake.nix | 117 | ||||
-rw-r--r-- | nix/modules/configuration.nix | 297 | ||||
-rw-r--r-- | nix/modules/default.nix | 1 | ||||
-rw-r--r-- | nix/modules/home/default.nix | 17 | ||||
-rw-r--r-- | nix/modules/home/hyprland.nix | 6 | ||||
-rw-r--r-- | nix/modules/home/user.nix | 11 | ||||
-rw-r--r-- | nix/modules/nginx.nix | 4 | ||||
-rw-r--r-- | nix/modules/ollama.nix | 2 | ||||
-rw-r--r-- | nix/modules/vars.nix | 7 | ||||
-rw-r--r-- | nix/systems/affinity/default.nix | 6 | ||||
-rw-r--r-- | nix/systems/continuity/default.nix | 2 | ||||
-rw-r--r-- | nix/systems/home.nix | 2 | ||||
-rw-r--r-- | nix/systems/installer/default.nix | 16 | ||||
-rw-r--r-- | nix/systems/spontaneity/default.nix | 7 | ||||
-rw-r--r-- | nix/topology/default.nix | 59 |
19 files changed, 444 insertions, 253 deletions
diff --git a/nix/modules/nvme-simple.nix b/nix/disko/nvme-simple.nix index 665c17e..665c17e 100644 --- a/nix/modules/nvme-simple.nix +++ b/nix/disko/nvme-simple.nix diff --git a/nix/modules/sda-simple.nix b/nix/disko/sda-simple.nix index fdf6556..fdf6556 100644 --- a/nix/modules/sda-simple.nix +++ b/nix/disko/sda-simple.nix diff --git a/nix/modules/vda-simple.nix b/nix/disko/vda-simple.nix index 32fa28d..32fa28d 100644 --- a/nix/modules/vda-simple.nix +++ b/nix/disko/vda-simple.nix diff --git a/nix/flake.lock b/nix/flake.lock index cf1fb58..6afd52c 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -21,6 +21,27 @@ "type": "github" } }, + "devshell": { + "inputs": { + "nixpkgs": [ + "nix-topology", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1728330715, + "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=", + "owner": "numtide", + "repo": "devshell", + "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": [ @@ -57,6 +78,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -117,6 +154,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -139,6 +194,28 @@ "type": "github" } }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "nix-topology", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -187,6 +264,29 @@ "type": "github" } }, + "nix-topology": { + "inputs": { + "devshell": "devshell", + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1738246091, + "narHash": "sha256-2+KkZsRO+XlOFbXbRgMZbRtlqn5MBNYj4HNmZ/2Tojg=", + "owner": "oddlama", + "repo": "nix-topology", + "rev": "5526269fa3eedf4f4bc00c0bf7a03db31d24b029", + "type": "github" + }, + "original": { + "owner": "oddlama", + "repo": "nix-topology", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1738277201, @@ -271,6 +371,33 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "gitignore": "gitignore_2", + "nixpkgs": [ + "nix-topology", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nix-topology", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730797577, + "narHash": "sha256-SrID5yVpyUfknUTGWgYkTyvdr9J1LxUym4om3SVGPkg=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "1864030ed24a2b8b4e4d386a5eeaf0c5369e50a9", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "pre-commit-hooks-nix": { "inputs": { "flake-compat": [ @@ -303,6 +430,7 @@ "disko": "disko", "home-manager": "home-manager", "lanzaboote": "lanzaboote", + "nix-topology": "nix-topology", "nixpkgs": "nixpkgs", "nur": "nur", "scripts": "scripts", @@ -399,6 +527,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/nix/flake.nix b/nix/flake.nix index 4c703cd..bab8574 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -3,86 +3,75 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; - + nur.url = "github:nix-community/NUR"; + sops-nix.url = "github:Mic92/sops-nix"; + scripts.url = "github:ret2pop/scripts"; + wallpapers.url = "github:ret2pop/wallpapers"; + sounds.url = "github:ret2pop/sounds"; + nix-topology = { + url = "github:oddlama/nix-topology"; + inputs.nixpkgs.follows = "nixpkgs"; + }; home-manager = { url = "github:nix-community/home-manager/release-24.11"; inputs.nixpkgs.follows = "nixpkgs"; }; - disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; }; - lanzaboote = { url = "github:nix-community/lanzaboote/v0.4.1"; inputs.nixpkgs.follows = "nixpkgs"; }; - - nur.url = "github:nix-community/NUR"; - sops-nix.url = "github:Mic92/sops-nix"; - scripts.url = "github:ret2pop/scripts"; - wallpapers.url = "github:ret2pop/wallpapers"; - sounds.url = "github:ret2pop/sounds"; }; - outputs = { nixpkgs, home-manager, nur, disko, lanzaboote, sops-nix, ... }@attrs: { - nixosConfigurations = { - installer = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ( - { pkgs, modulesPath, ... }: - { - imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ]; - } - ) - ./systems/installer/default.nix - ]; - }; + outputs = { self, nixpkgs, home-manager, nur, disko, lanzaboote, sops-nix, nix-topology, ... }@attrs: + let + system = "x86_64-linux"; + mkConfigs = map (hostname: { + name = "${hostname}"; + value = nixpkgs.lib.nixosSystem { + system = system; + specialArgs = attrs; + modules = if (hostname == "installer") then [ + (./. + "/systems/${hostname}/default.nix") + { networking.hostName = "${hostname}"; } + nix-topology.nixosModules.default + ] else [ + nix-topology.nixosModules.default + lanzaboote.nixosModules.lanzaboote + disko.nixosModules.disko + home-manager.nixosModules.home-manager + sops-nix.nixosModules.sops + { + nixpkgs.overlays = [ nur.overlays.default ]; + home-manager.extraSpecialArgs = attrs; + networking.hostName = "${hostname}"; + } + (./. + "/systems/${hostname}/default.nix") + ]; + }; + }); - continuity = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = attrs; - modules = [ - lanzaboote.nixosModules.lanzaboote - disko.nixosModules.disko - home-manager.nixosModules.home-manager - sops-nix.nixosModules.sops - { nixpkgs.overlays = [ nur.overlays.default ]; } - { home-manager.extraSpecialArgs = attrs; } - ./systems/continuity/default.nix - ]; - }; + pkgs = import nixpkgs { + inherit system; + overlays = [ nix-topology.overlays.default ]; + }; + in { + nixosConfigurations = builtins.listToAttrs (mkConfigs [ + "affinity" + "continuity" + "installer" + "spontaneity" + ]); - affinity = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = attrs; - modules = [ - lanzaboote.nixosModules.lanzaboote - disko.nixosModules.disko - home-manager.nixosModules.home-manager - sops-nix.nixosModules.sops - { nixpkgs.overlays = [ nur.overlays.default ]; } - { home-manager.extraSpecialArgs = attrs; } - ./systems/affinity/default.nix - ]; - }; - - spontaneity = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = attrs; - modules = [ - lanzaboote.nixosModules.lanzaboote - disko.nixosModules.disko - home-manager.nixosModules.home-manager - sops-nix.nixosModules.sops - { nixpkgs.overlays = [ nur.overlays.default ]; } - { home-manager.extraSpecialArgs = attrs; } - ./systems/spontaneity/hardware-configuration.nix - ./systems/spontaneity/default.nix + topology."${system}" = import nix-topology { + inherit pkgs; + modules = [ + ./topology/default.nix + { nixosConfigurations = self.nixosConfigurations; } ]; - }; + }; }; - }; } diff --git a/nix/modules/configuration.nix b/nix/modules/configuration.nix index 36a1702..1d175dc 100644 --- a/nix/modules/configuration.nix +++ b/nix/modules/configuration.nix @@ -24,10 +24,10 @@ environment = { etc = { - securetty.text = '' - # /etc/securetty: list of terminals on which root is allowed to login. - # See securetty(5) and login(1). - ''; + securetty.text = '' + # /etc/securetty: list of terminals on which root is allowed to login. + # See securetty(5) and login(1). + ''; }; }; @@ -35,13 +35,13 @@ coredump.enable = false; network.config.networkConfig.IPv6PrivacyExtensions = "kernel"; tmpfiles.settings = { - "restricthome"."/home/*".Z.mode = "~0700"; + "restricthome"."/home/*".Z.mode = "~0700"; - "restrictetcnixos"."/etc/nixos/*".Z = { - mode = "0000"; - user = "root"; - group = "root"; - }; + "restrictetcnixos"."/etc/nixos/*".Z = { + mode = "0000"; + user = "root"; + group = "root"; + }; }; }; @@ -50,138 +50,137 @@ extraModulePackages = [ ]; initrd = { - availableKernelModules = [ - "xhci_pci" - "ahci" - "usb_storage" - "sd_mod" - "nvme" - "sd_mod" - "ehci_pci" - "rtsx_pci_sdmmc" - "usbhid" - ]; - - kernelModules = [ ]; + availableKernelModules = [ + "xhci_pci" + "ahci" + "usb_storage" + "sd_mod" + "nvme" + "sd_mod" + "ehci_pci" + "rtsx_pci_sdmmc" + "usbhid" + ]; + + kernelModules = [ ]; }; lanzaboote = { - enable = config.monorepo.profiles.secureBoot.enable; - pkiBundle = "/etc/secureboot"; + enable = config.monorepo.profiles.secureBoot.enable; + pkiBundle = "/etc/secureboot"; }; loader = { - systemd-boot.enable = lib.mkForce (! config.monorepo.profiles.grub.enable); - efi.canTouchEfiVariables = lib.mkDefault (! config.monorepo.profiles.grub.enable); + systemd-boot.enable = lib.mkForce (! config.monorepo.profiles.grub.enable); + efi.canTouchEfiVariables = lib.mkDefault (! config.monorepo.profiles.grub.enable); }; kernelModules = [ - "snd-seq" - "snd-rawmidi" - "xhci_hcd" - "kvm_intel" + "snd-seq" + "snd-rawmidi" + "xhci_hcd" + "kvm_intel" ]; kernelParams = [ - "debugfs=off" - "page_alloc.shuffle=1" - "slab_nomerge" - "page_poison=1" - - # madaidan - "pti=on" - "randomize_kstack_offset=on" - "vsyscall=none" - "module.sig_enforce=1" - "lockdown=confidentiality" - - # cpu - "spectre_v2=on" - "spec_store_bypass_disable=on" - "tsx=off" - "tsx_async_abort=full,nosmt" - "mds=full,nosmt" - "l1tf=full,force" - "nosmt=force" - "kvm.nx_huge_pages=force" - - # hardened - "extra_latent_entropy" - - # mineral - "init_on_alloc=1" - "random.trust_cpu=off" - "random.trust_bootloader=off" - "intel_iommu=on" - "amd_iommu=force_isolation" - "iommu=force" - "iommu.strict=1" - "init_on_free=1" - "quiet" - "loglevel=0" + "debugfs=off" + "page_alloc.shuffle=1" + "slab_nomerge" + "page_poison=1" + + # madaidan + "pti=on" + "randomize_kstack_offset=on" + "vsyscall=none" + "module.sig_enforce=1" + "lockdown=confidentiality" + + # cpu + "spectre_v2=on" + "spec_store_bypass_disable=on" + "tsx=off" + "tsx_async_abort=full,nosmt" + "mds=full,nosmt" + "l1tf=full,force" + "nosmt=force" + "kvm.nx_huge_pages=force" + + # hardened + "extra_latent_entropy" + + # mineral + "init_on_alloc=1" + "random.trust_cpu=off" + "random.trust_bootloader=off" + "intel_iommu=on" + "amd_iommu=force_isolation" + "iommu=force" + "iommu.strict=1" + "init_on_free=1" + "quiet" + "loglevel=0" ]; blacklistedKernelModules = [ - "netrom" - "rose" - - "adfs" - "affs" - "bfs" - "befs" - "cramfs" - "efs" - "erofs" - "exofs" - "freevxfs" - "f2fs" - "hfs" - "hpfs" - "jfs" - "minix" - "nilfs2" - "ntfs" - "omfs" - "qnx4" - "qnx6" - "sysv" - "ufs" + "netrom" + "rose" + + "adfs" + "affs" + "bfs" + "befs" + "cramfs" + "efs" + "erofs" + "exofs" + "freevxfs" + "f2fs" + "hfs" + "hpfs" + "jfs" + "minix" + "nilfs2" + "ntfs" + "omfs" + "qnx4" + "qnx6" + "sysv" + "ufs" ]; kernel.sysctl = { - "kernel.ftrace_enabled" = false; - "net.core.bpf_jit_enable" = false; - "kernel.kptr_restrict" = 2; - - # madaidan - "vm.swappiness" = 1; - "vm.unprivileged_userfaultfd" = 0; - "dev.tty.ldisc_autoload" = 0; - "kernel.kexec_load_disabled" = 1; - "kernel.sysrq" = 4; - "kernel.perf_event_paranoid" = 3; - - # net - "net.ipv4.icmp_echo_ignore_broadcasts" = true; - - "net.ipv4.conf.all.accept_redirects" = false; - "net.ipv4.conf.all.secure_redirects" = false; - "net.ipv4.conf.default.accept_redirects" = false; - "net.ipv4.conf.default.secure_redirects" = false; - "net.ipv6.conf.all.accept_redirects" = false; - "net.ipv6.conf.default.accept_redirects" = false; + "kernel.ftrace_enabled" = false; + "net.core.bpf_jit_enable" = false; + "kernel.kptr_restrict" = 2; + + # madaidan + "vm.swappiness" = 1; + "vm.unprivileged_userfaultfd" = 0; + "dev.tty.ldisc_autoload" = 0; + "kernel.kexec_load_disabled" = 1; + "kernel.sysrq" = 4; + "kernel.perf_event_paranoid" = 3; + + # net + "net.ipv4.icmp_echo_ignore_broadcasts" = true; + + "net.ipv4.conf.all.accept_redirects" = false; + "net.ipv4.conf.all.secure_redirects" = false; + "net.ipv4.conf.default.accept_redirects" = false; + "net.ipv4.conf.default.secure_redirects" = false; + "net.ipv6.conf.all.accept_redirects" = false; + "net.ipv6.conf.default.accept_redirects" = false; }; }; networking = { useDHCP = lib.mkDefault true; - hostName = config.monorepo.vars.hostName; networkmanager = { - enable = true; + enable = true; }; firewall = { - allowedTCPPorts = [ 22 11434 ]; - allowedUDPPorts = [ ]; + allowedTCPPorts = [ 22 11434 ]; + allowedUDPPorts = [ ]; }; }; @@ -192,16 +191,16 @@ pulseaudio.enable = ! config.monorepo.profiles.pipewire.enable; bluetooth = { - enable = true; - powerOnBoot = true; + enable = true; + powerOnBoot = true; }; }; services = { chrony = { - enable = true; - enableNTS = true; - servers = [ "time.cloudflare.com" "ptbtime1.ptb.de" "ptbtime2.ptb.de" ]; + enable = true; + enableNTS = true; + servers = [ "time.cloudflare.com" "ptbtime1.ptb.de" "ptbtime2.ptb.de" ]; }; jitterentropy-rngd.enable = true; @@ -214,12 +213,12 @@ # Misc. udev = { - extraRules = ''''; - packages = with pkgs; [ - platformio-core - platformio-core.udev - openocd - ]; + extraRules = ''''; + packages = with pkgs; [ + platformio-core + platformio-core.udev + openocd + ]; }; printing.enable = true; @@ -236,20 +235,20 @@ nixpkgs = { hostPlatform = lib.mkDefault "x86_64-linux"; config = { - allowUnfree = true; - cudaSupport = lib.mkDefault config.monorepo.profiles.cuda.enable; + allowUnfree = true; + cudaSupport = lib.mkDefault config.monorepo.profiles.cuda.enable; }; }; security = { apparmor = { - enable = true; - killUnconfinedConfinables = true; + enable = true; + killUnconfinedConfinables = true; }; pam.loginLimits = [ - { domain = "*"; item = "nofile"; type = "-"; value = "32768"; } - { domain = "*"; item = "memlock"; type = "-"; value = "32768"; } + { domain = "*"; item = "nofile"; type = "-"; value = "32768"; } + { domain = "*"; item = "memlock"; type = "-"; value = "32768"; } ]; rtkit.enable = true; @@ -259,9 +258,9 @@ forcePageTableIsolation = true; tpm2 = { - enable = true; - pkcs11.enable = true; - tctiEnvironment.enable = true; + enable = true; + pkcs11.enable = true; + tctiEnvironment.enable = true; }; auditd.enable = true; @@ -274,9 +273,9 @@ enable = true; wlr.enable = true; extraPortals = with pkgs; [ - xdg-desktop-portal-gtk - xdg-desktop-portal - xdg-desktop-portal-hyprland + xdg-desktop-portal-gtk + xdg-desktop-portal + xdg-desktop-portal-hyprland ]; config.common.default = "*"; }; @@ -289,23 +288,25 @@ curl ]; + users.groups.git = {}; users.users = { root.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICts6+MQiMwpA+DfFQxjIN214Jn0pCw/2BDvOzPhR/H2 preston@continuity-dell" ]; git = { - isSystemUser = true; - home = "/srv/git"; - shell = "${pkgs.git}/bin/git-shell"; + isSystemUser = true; + home = "/srv/git"; + shell = "${pkgs.git}/bin/git-shell"; + group = "git"; }; "${config.monorepo.vars.userName}" = { - initialPassword = "${config.monorepo.vars.userName}"; - isNormalUser = true; - description = config.monorepo.vars.fullName; - extraGroups = [ "networkmanager" "wheel" "video" "docker" "jackaudio" "tss" "dialout" ]; - shell = pkgs.zsh; - packages = []; + initialPassword = "${config.monorepo.vars.userName}"; + isNormalUser = true; + description = config.monorepo.vars.fullName; + extraGroups = [ "networkmanager" "wheel" "video" "docker" "jackaudio" "tss" "dialout" ]; + shell = pkgs.zsh; + packages = []; }; }; diff --git a/nix/modules/default.nix b/nix/modules/default.nix index 50e5a1b..00a188b 100644 --- a/nix/modules/default.nix +++ b/nix/modules/default.nix @@ -17,6 +17,7 @@ server.enable = lib.mkEnableOption "Enables server services"; ttyonly.enable = lib.mkEnableOption "TTY only, no xserver"; grub.enable = lib.mkEnableOption "Enables grub instead of systemd-boot"; + workstation.enable = lib.mkEnableOption "Enables workstation services"; }; }; }; diff --git a/nix/modules/home/default.nix b/nix/modules/home/default.nix index 45b0890..13966da 100644 --- a/nix/modules/home/default.nix +++ b/nix/modules/home/default.nix @@ -42,23 +42,8 @@ music.enable = lib.mkEnableOption "Enables mpd"; workstation.enable = lib.mkEnableOption "Enables workstation packages (music production and others)"; cuda.enable = lib.mkEnableOption "Enables CUDA user package builds"; + hyprland.enable = lib.mkEnableOption "Enables hyprland"; - hyprland = { - enable = lib.mkEnableOption "Enables hyprland"; - monitors = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = [ - "HDMI-A-1" - "eDP-1" - "DP-2" - "DP-3" - "LVDS-1" - "DP-4" - ]; - example = []; - description = "Hyprland monitors"; - }; - }; email = { email = lib.mkOption { type = lib.types.str; diff --git a/nix/modules/home/hyprland.nix b/nix/modules/home/hyprland.nix index 36e1621..1463f90 100644 --- a/nix/modules/home/hyprland.nix +++ b/nix/modules/home/hyprland.nix @@ -7,6 +7,12 @@ systemd.enable = true; settings = { "$mod" = "SUPER"; + bezier = [ + "overshot,0,1,0,0.95" + ]; + animation = [ + "workspaces, 1, 10, overshot" + ]; exec-once = [ "waybar" "swww-daemon --format xrgb" diff --git a/nix/modules/home/user.nix b/nix/modules/home/user.nix index 882041b..85b6a70 100644 --- a/nix/modules/home/user.nix +++ b/nix/modules/home/user.nix @@ -62,12 +62,17 @@ pfetch libnotify htop - (writeShellScriptBin "install_vps" + (writeShellScriptBin "remote-build" '' #!/bin/bash -nix run github:nix-community/nixos-anywhere -- --generate-hardware-config nixos-generate-config ./systems/spontaneity/hardware-configuration.nix --flake .#spontaneity --target-host "$1" - '' +nixos-rebuild --target-host "$1" switch --flake .#spontaneity +'' ) + (writeShellScriptBin "install-vps" + '' +#!/bin/bash +nix run github:nix-community/nixos-anywhere -- --generate-hardware-config nixos-generate-config ./systems/spontaneity/hardware-configuration.nix --flake .#spontaneity --target-host "$1" + '') ] else [ pfetch diff --git a/nix/modules/nginx.nix b/nix/modules/nginx.nix index e8c4682..bcc213a 100644 --- a/nix/modules/nginx.nix +++ b/nix/modules/nginx.nix @@ -1,7 +1,7 @@ -{ config, services, ... }: +{ config, lib, services, ... }: { services.nginx = { - enable = true; + enable = lib.mkDefault config.monorepo.profiles.server.enable; # Use recommended settings recommendedGzipSettings = true; diff --git a/nix/modules/ollama.nix b/nix/modules/ollama.nix index f9f4dc9..96ee918 100644 --- a/nix/modules/ollama.nix +++ b/nix/modules/ollama.nix @@ -1,7 +1,7 @@ { config, lib, ... }: { services.ollama = { - enable = lib.mkDefault config.monorepo.profiles.server.enable; + enable = lib.mkDefault config.monorepo.profiles.workstation.enable; acceleration = "cuda"; host = "0.0.0.0"; }; diff --git a/nix/modules/vars.nix b/nix/modules/vars.nix index 5652a93..5d22584 100644 --- a/nix/modules/vars.nix +++ b/nix/modules/vars.nix @@ -1,13 +1,6 @@ { lib, ... }: { options.monorepo.vars = { - hostName = lib.mkOption { - type = lib.types.str; - default = "continuity"; - example = "hostname"; - description = "system hostname"; - }; - userName = lib.mkOption { type = lib.types.str; default = "preston"; diff --git a/nix/systems/affinity/default.nix b/nix/systems/affinity/default.nix index 606d934..7f1f29d 100644 --- a/nix/systems/affinity/default.nix +++ b/nix/systems/affinity/default.nix @@ -2,16 +2,16 @@ { imports = [ ../../modules/default.nix - ../../modules/nvme-simple.nix + ../../disko/nvme-simple.nix ../home.nix ]; config = { monorepo = { profiles = { - server.enable = true; + server.enable = false; cuda.enable = true; + workstation.enable = true; }; - vars.hostName = "affinity"; }; }; } diff --git a/nix/systems/continuity/default.nix b/nix/systems/continuity/default.nix index d067581..4899804 100644 --- a/nix/systems/continuity/default.nix +++ b/nix/systems/continuity/default.nix @@ -2,7 +2,7 @@ { imports = [ ../../modules/default.nix - ../../modules/sda-simple.nix + ../../disko/sda-simple.nix ../home.nix ]; } diff --git a/nix/systems/home.nix b/nix/systems/home.nix index af4aa68..c1252df 100644 --- a/nix/systems/home.nix +++ b/nix/systems/home.nix @@ -6,6 +6,6 @@ ]; useGlobalPkgs = true; useUserPackages = true; - users."${config.monorepo.vars.userName}" = import (./. + "/${config.monorepo.vars.hostName}/home.nix"); + users."${config.monorepo.vars.userName}" = import (./. + "/${config.networking.hostName}/home.nix"); }; } diff --git a/nix/systems/installer/default.nix b/nix/systems/installer/default.nix index 2b832f4..d3d1693 100644 --- a/nix/systems/installer/default.nix +++ b/nix/systems/installer/default.nix @@ -1,10 +1,13 @@ -{ pkgs, config, lib, ... }: +{ pkgs, config, lib, modulesPath, ... }: let commits = import ./commits.nix; in { + imports = [ + (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") + ]; + networking = { - hostName = "nixos"; networkmanager = { enable = true; }; @@ -40,6 +43,9 @@ in '' #!/usr/bin/env bash +SYSTEM=continuity +DRIVE=sda + set -euo pipefail if [ "$(id -u)" -eq 0 ]; then echo "ERROR! $(basename "$0") should be run as a regular user" @@ -52,10 +58,10 @@ if [ ! -d "$HOME/monorepo/" ]; then cd monorepo git checkout "${commits.monorepoCommitHash}" fi -vim "$HOME/monorepo/nix/systems/continuity/default.nix" -sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/modules/sda-simple.nix" +vim "$HOME/monorepo/nix/systems/$SYSTEM/default.nix" +sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/${commits.diskoCommitHash}" -- --mode destroy,format,mount "$HOME/monorepo/nix/disko/$DRIVE-simple.nix" cd /mnt -sudo nixos-install --flake $HOME/monorepo/nix#continuity +sudo nixos-install --flake "$HOME/monorepo/nix#$SYSTEM" sudo cp -r $HOME/monorepo "/mnt/home/$(ls /mnt/home/)/" echo "rebooting..."; sleep 3; reboot '') diff --git a/nix/ |