Major refactor

This commit is contained in:
2026-02-03 20:27:29 +01:00
parent 4ad7ca2330
commit af4917598e
11 changed files with 95 additions and 249 deletions

118
flake.lock generated
View File

@@ -220,68 +220,6 @@
"type": "github" "type": "github"
} }
}, },
"home-manager-stable-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs-stable-darwin"
]
},
"locked": {
"lastModified": 1747688870,
"narHash": "sha256-ypL9WAZfmJr5V70jEVzqGjjQzF0uCkz+AFQF7n9NmNc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "d5f1f641b289553927b3801580598d200a501863",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-24.11",
"repo": "home-manager",
"type": "github"
}
},
"home-manager-stable-nixos": {
"inputs": {
"nixpkgs": [
"nixpkgs-stable-nixos"
]
},
"locked": {
"lastModified": 1747688870,
"narHash": "sha256-ypL9WAZfmJr5V70jEVzqGjjQzF0uCkz+AFQF7n9NmNc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "d5f1f641b289553927b3801580598d200a501863",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-24.11",
"repo": "home-manager",
"type": "github"
}
},
"home-manager-unstable": {
"inputs": {
"nixpkgs": [
"nixpkgs-unstable"
]
},
"locked": {
"lastModified": 1769947980,
"narHash": "sha256-BI9jqPa6da7wmFRZWMKR3gw6+IseRsM0QnegNCv5B4E=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ddf76d161863a903c624f527badf818ec52c1a76",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"hyprcursor": { "hyprcursor": {
"inputs": { "inputs": {
"hyprlang": [ "hyprlang": [
@@ -806,54 +744,6 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-stable-darwin": {
"locked": {
"lastModified": 1751290243,
"narHash": "sha256-kNf+obkpJZWar7HZymXZbW+Rlk3HTEIMlpc6FCNz0Ds=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5ab036a8d97cb9476fbe81b09076e6e91d15e1b6",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-24.11-darwin",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable-nixos": {
"locked": {
"lastModified": 1751274312,
"narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1769740369,
"narHash": "sha256-xKPyJoMoXfXpDM5DFDZDsi9PHArf2k5BJjvReYXoFpM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "6308c3b21396534d8aaeac46179c14c439a89b8a",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1767379071, "lastModified": 1767379071,
@@ -906,7 +796,7 @@
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": [ "nixpkgs": [
"nixpkgs-unstable" "nixpkgs"
], ],
"nixvim": "nixvim_2" "nixvim": "nixvim_2"
}, },
@@ -1008,15 +898,9 @@
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"home-manager-stable-darwin": "home-manager-stable-darwin",
"home-manager-stable-nixos": "home-manager-stable-nixos",
"home-manager-unstable": "home-manager-unstable",
"hyprland": "hyprland", "hyprland": "hyprland",
"millennium": "millennium", "millennium": "millennium",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"nixpkgs-stable-darwin": "nixpkgs-stable-darwin",
"nixpkgs-stable-nixos": "nixpkgs-stable-nixos",
"nixpkgs-unstable": "nixpkgs-unstable",
"nixvim": "nixvim", "nixvim": "nixvim",
"nur": "nur" "nur": "nur"
} }

View File

@@ -2,19 +2,6 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
millennium.url = "github:trivaris/millennium?dir=packages/nix"; # Temporary fix until this is merged into main millennium repo millennium.url = "github:trivaris/millennium?dir=packages/nix"; # Temporary fix until this is merged into main millennium repo
home-manager-unstable = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
home-manager-stable-nixos = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs-stable-nixos";
};
home-manager-stable-darwin = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs-stable-darwin";
};
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@@ -22,7 +9,7 @@
nixvim = { nixvim = {
url = "github:Superredstone/nixvim"; url = "github:Superredstone/nixvim";
inputs.nixpkgs.follows = "nixpkgs-unstable"; inputs.nixpkgs.follows = "nixpkgs";
}; };
hyprland.url = "github:hyprwm/Hyprland"; hyprland.url = "github:hyprwm/Hyprland";
nur = { nur = {
@@ -44,7 +31,9 @@
nixvim nixvim
millennium millennium
nur nur
inputs; inputs
nixpkgs
home-manager;
}; };
in in
{ {

View File

@@ -5,60 +5,26 @@
millennium, millennium,
nur, nur,
inputs, inputs,
nixpkgs,
home-manager,
}: }:
name: name:
{ {
system, system,
user, user,
email, email,
wsl ? false,
stable ? false, stable ? false,
gamingSystem ? false, gamingSystem ? false,
workSystem ? false, workSystem ? false,
desktopEnvironment ? "" desktopEnvironment ? ""
}: }:
let let
# True if this is a WSL system.
isWSL = wsl;
# resolves NixOS vs nix-darwin and stable vs unstable functions
inherit
(import ./resolve-inputs.nix {
inherit
system
stable
inputs
;
})
isDarwin
lib
systemFunc
nixpkgs-stable
home-manager
;
# The config files for this system.
nixConfig = ../modules/nix-config/default.nix; nixConfig = ../modules/nix-config/default.nix;
machineConfig = ../machines/${name}/default.nix; machineConfig = ../machines/${name}/default.nix;
# OSConfig = ../modules/${if isDarwin then "darwin" else "nixos"}.nix;
HMConfig = ../home; HMConfig = ../home;
systemPackages = ../modules/packages.nix; systemPackages = ../modules/packages.nix;
# TODO: make this cleaner
nix-homebrew = lib.optionalAttrs isDarwin inputs.nix-homebrew.darwinModules.nix-homebrew;
nix-homebrew-config = lib.optionalAttrs isDarwin {
nix-homebrew = {
enable = true;
inherit user;
# Detect and automatically migrate existing Homebrew installations
autoMigrate = true;
# With mutableTaps disabled, taps can no longer be added imperatively with `brew tap`.
#mutableTaps = false;
};
};
specialArgs = { specialArgs = {
pkgs-stable = import nixpkgs-stable { pkgs-stable = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
pkgs-unstable = import inputs.nixpkgs-unstable {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
}; };
@@ -69,28 +35,21 @@ let
currentSystemDe = desktopEnvironment; currentSystemDe = desktopEnvironment;
gamingSystem = gamingSystem; gamingSystem = gamingSystem;
workSystem = workSystem; workSystem = workSystem;
isWSL = isWSL;
isDarwin = isDarwin;
nixvim = nixvim; nixvim = nixvim;
millennium = millennium; millennium = millennium;
nur = nur; nur = nur;
inputs = inputs; inputs = inputs;
}; };
in in
assert isWSL -> !isDarwin; nixpkgs.lib.nixosSystem {
systemFunc {
inherit system specialArgs; inherit system specialArgs;
modules = [ modules = [
{ nixpkgs.overlays = overlays; } { nixpkgs.overlays = overlays; }
{ nixpkgs.config.allowUnfree = true; }
(if isWSL then inputs.nixos-wsl.nixosModules.wsl else { })
nixConfig nixConfig
systemPackages systemPackages
nix-homebrew
nix-homebrew-config
nur.modules.nixos.default nur.modules.nixos.default
nur.legacyPackages."${system}".repos.iopq.modules.xraya nur.legacyPackages."${system}".repos.iopq.modules.xraya
home-manager.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.backupFileExtension = "backup"; home-manager.backupFileExtension = "backup";
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;

View File

@@ -4,16 +4,13 @@
system, system,
}: }:
let let
isDarwin = (import inputs.nixpkgs-unstable { inherit system; }).stdenv.isDarwin;
darwin = if stable then inputs.darwin-stable else inputs.darwin-unstable;
nixpkgs-stable = inputs."nixpkgs-unstable"; nixpkgs-stable = inputs."nixpkgs-unstable";
nixpkgs = if stable then nixpkgs-stable else inputs.nixpkgs-unstable; nixpkgs = if stable then nixpkgs-stable else inputs.nixpkgs-unstable;
home-manager = inputs.home-manager-unstable; home-manager = inputs.home-manager-unstable;
in in
{ {
inherit isDarwin nixpkgs-stable; systemFunc = nixpkgs.lib.nixosSystem;
systemFunc = if isDarwin then darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem; home-manager = home-manager.nixosModules;
home-manager = if isDarwin then home-manager.darwinModules else home-manager.nixosModules;
inherit (import nixpkgs { inherit system; }) lib; inherit (import nixpkgs { inherit system; }) lib;
} }

View File

@@ -1,24 +1,30 @@
{ pkgs, lib, currentSystemDe, ... }: { pkgs, lib, currentSystemDe, ... }:
{ {
services.xserver.enable = true; service = {
services.xserver.excludePackages = with pkgs; [ xserver.enable = true;
xterm xserver.excludePackages = with pkgs; [
]; xterm
];
# Display managers # Display managers
services.displayManager.sddm = lib.mkIf (currentSystemDe == "plasma") { displayManager = {
enable = true; sddm = lib.mkIf (currentSystemDe == "plasma") {
wayland.enable = true; enable = true;
wayland.enable = true;
};
gdm.enable = lib.mkIf (currentSystemDe == "gnome") true;
};
# Desktop environments
desktopManager = {
plasma6.enable = lib.mkIf (currentSystemDe == "plasma") true;
gnome.enable = lib.mkIf (currentSystemDe == "gnome") true;
};
}; };
services.displayManager.gdm.enable = lib.mkIf (currentSystemDe == "gnome") true;
# Desktop environments
services.desktopManager.plasma6.enable = lib.mkIf (currentSystemDe == "plasma") true;
environment.plasma6.excludePackages = with pkgs.kdePackages; [ environment.plasma6.excludePackages = with pkgs.kdePackages; [
elisa elisa
konsole konsole
]; ];
services.desktopManager.gnome.enable = lib.mkIf (currentSystemDe == "gnome") true;
environment.gnome.excludePackages = with pkgs; [ environment.gnome.excludePackages = with pkgs; [
gnome-contacts gnome-contacts
gnome-console gnome-console
@@ -37,16 +43,12 @@
xdg = { xdg = {
autostart.enable = true; autostart.enable = true;
portal = { portal.enable = true;
enable = true;
extraPortals = with pkgs; [
# xdg-desktop-portal-gtk
];
};
}; };
programs.kdeconnect = lib.mkIf (currentSystemDe != "none") { programs.kdeconnect = lib.mkIf (currentSystemDe != "none") {
enable = true; enable = true;
# FIXME: Make this work for KDE
package = pkgs.gnomeExtensions.gsconnect; package = pkgs.gnomeExtensions.gsconnect;
}; };
} }

View File

@@ -3,27 +3,29 @@
imports = [ imports = [
./keyboard.nix ./keyboard.nix
./security.nix ./security.nix
./services.nix
] ++ (if (currentSystemDe != "none") then [ ] ++ (if (currentSystemDe != "none") then [
./sound.nix
./fonts.nix
./de.nix ./de.nix
./fonts.nix
./sound.nix
] else []); ] else []);
time.timeZone = "Europe/Rome"; time.timeZone = "Europe/Rome";
# Select internationalisation properties. # Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8"; i18n = {
defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = { extraLocaleSettings = {
LC_ADDRESS = "it_IT.UTF-8"; LC_ADDRESS = "it_IT.UTF-8";
LC_IDENTIFICATION = "it_IT.UTF-8"; LC_IDENTIFICATION = "it_IT.UTF-8";
LC_MEASUREMENT = "it_IT.UTF-8"; LC_MEASUREMENT = "it_IT.UTF-8";
LC_MONETARY = "it_IT.UTF-8"; LC_MONETARY = "it_IT.UTF-8";
LC_NAME = "it_IT.UTF-8"; LC_NAME = "it_IT.UTF-8";
LC_NUMERIC = "it_IT.UTF-8"; LC_NUMERIC = "it_IT.UTF-8";
LC_PAPER = "it_IT.UTF-8"; LC_PAPER = "it_IT.UTF-8";
LC_TELEPHONE = "it_IT.UTF-8"; LC_TELEPHONE = "it_IT.UTF-8";
LC_TIME = "it_IT.UTF-8"; LC_TIME = "it_IT.UTF-8";
};
}; };
environment.sessionVariables = { environment.sessionVariables = {

View File

@@ -0,0 +1,7 @@
{ ... }:
{
services = {
pcscd.enable = true;
nordvpn.enable = true;
};
}

View File

@@ -1,13 +1,14 @@
{ ... }: { ... }:
{ {
# Enable sound with pipewire. # Enable sound with pipewire.
services.pulseaudio.enable = false; services = {
security.rtkit.enable = true; pipewire = {
enable = true;
services.pipewire = { alsa.enable = true;
enable = true; alsa.support32Bit = true;
alsa.enable = true; pulse.enable = true;
alsa.support32Bit = true; };
pulse.enable = true; pulseaudio.enable = false;
}; };
security.rtkit.enable = true;
} }

View File

@@ -1,9 +1,11 @@
{ pkgs, nur, gamingSystem, workSystem, currentSystemDe, ... }@ inputs: { pkgs, nur, gamingSystem, workSystem, currentSystemDe, ... }@ inputs:
{ {
imports = [ imports = [
./nordvpn.nix ./programs
]; ];
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# CLI utils # CLI utils
appimage-run appimage-run
@@ -97,26 +99,4 @@
gnome-tweaks gnome-tweaks
] else []); ] else []);
programs.gamescope = {
enable = true;
capSysNice = true;
};
programs.steam = if gamingSystem then {
enable = true;
# package = pkgs.steam-millennium;
remotePlay.openFirewall = true;
} else {};
programs.hyprland.enable = if currentSystemDe == "hyprland" then true else false;
services.pcscd.enable = true;
programs.gnupg.agent = {
enable = true;
pinentryPackage = pkgs.pinentry-tty;
enableSSHSupport = true;
};
programs.nh = {
enable = true;
};
} }

View File

@@ -0,0 +1,27 @@
{ pkgs, gamingSystem, currentSystemDe, ... }:
{
imports = [
./nordvpn.nix
];
programs = {
gamescope = {
enable = true;
capSysNice = true;
};
steam = if gamingSystem then {
enable = true;
# package = pkgs.steam-millennium;
remotePlay.openFirewall = true;
} else {};
gnupg.agent = {
enable = true;
pinentryPackage = pkgs.pinentry-tty;
enableSSHSupport = true;
};
nh = {
enable = true;
};
hyprland.enable = if currentSystemDe == "hyprland" then true else false;
};
}

View File

@@ -10,6 +10,4 @@
nordvpn = pkgs.nur.repos.wingej0.nordvpn; nordvpn = pkgs.nur.repos.wingej0.nordvpn;
}) })
]; ];
services.nordvpn.enable = true;
} }