2023-11-22 15:33:16 -05:00
|
|
|
{
|
|
|
|
config,
|
2023-12-03 04:50:17 -05:00
|
|
|
home-manager,
|
2024-03-26 13:55:55 -04:00
|
|
|
lib,
|
2023-11-22 15:33:16 -05:00
|
|
|
nh,
|
2024-11-21 21:44:30 -05:00
|
|
|
nixd,
|
2023-11-22 15:33:16 -05:00
|
|
|
pkgs,
|
2024-06-15 22:51:36 -04:00
|
|
|
self,
|
2023-11-22 15:33:16 -05:00
|
|
|
...
|
2024-11-21 21:44:30 -05:00
|
|
|
}: let
|
|
|
|
inherit (lib) attrValues filter findFirst isAttrs hasAttr mkIf mkOption types;
|
|
|
|
in {
|
2023-10-15 14:43:23 -04:00
|
|
|
imports = [
|
2024-01-24 18:39:18 -05:00
|
|
|
./vars
|
2023-10-28 18:20:09 -04:00
|
|
|
|
2023-12-01 03:07:17 -05:00
|
|
|
./modules
|
2024-07-28 01:44:16 -04:00
|
|
|
./packages.nix
|
2024-08-02 22:32:29 -04:00
|
|
|
self.nixosModules.borgbackup
|
2023-10-28 18:20:09 -04:00
|
|
|
|
2023-12-03 04:50:17 -05:00
|
|
|
home-manager.nixosModules.home-manager
|
2023-10-15 14:43:23 -04:00
|
|
|
];
|
|
|
|
|
2024-04-18 14:37:46 -04:00
|
|
|
boot.tmp.useTmpfs = true;
|
2023-10-15 13:30:21 -04:00
|
|
|
|
2024-06-28 13:40:52 -04:00
|
|
|
systemd.services.nix-daemon = {
|
2024-06-28 17:43:43 -04:00
|
|
|
environment.TMPDIR = "/home/nix-cache";
|
2024-06-28 13:40:52 -04:00
|
|
|
preStart = ''
|
|
|
|
mkdir -p ${config.systemd.services.nix-daemon.environment.TMPDIR}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-10-15 13:30:21 -04:00
|
|
|
nix = {
|
2024-11-21 21:44:30 -05:00
|
|
|
package = let
|
|
|
|
nixdInput =
|
|
|
|
findFirst
|
|
|
|
(x: x.pname == "nix") {}
|
|
|
|
nixd.packages.${pkgs.system}.nixd.buildInputs;
|
|
|
|
|
|
|
|
throws = x: !(builtins.tryEval x).success;
|
|
|
|
hasVersion = x: isAttrs x && hasAttr "version" x;
|
|
|
|
|
|
|
|
nixVersions = filter (x: ! throws x && hasVersion x) (attrValues pkgs.nixVersions);
|
|
|
|
in
|
|
|
|
findFirst (x: x.version == nixdInput.version) {} nixVersions;
|
2024-07-24 21:58:37 -04:00
|
|
|
|
2023-10-15 13:30:21 -04:00
|
|
|
# Edit nix.conf
|
|
|
|
settings = {
|
2024-02-14 14:50:51 -05:00
|
|
|
# Store
|
2023-10-15 13:30:21 -04:00
|
|
|
keep-outputs = true;
|
|
|
|
keep-derivations = true;
|
|
|
|
auto-optimise-store = true;
|
2024-02-14 14:50:51 -05:00
|
|
|
|
|
|
|
# Commands
|
|
|
|
experimental-features = ["nix-command" "flakes"];
|
|
|
|
http-connections = 0; # unlimited for local cache
|
2023-10-15 13:30:21 -04:00
|
|
|
warn-dirty = false;
|
2024-02-14 14:50:51 -05:00
|
|
|
show-trace = true;
|
2024-06-10 22:57:20 -04:00
|
|
|
allow-import-from-derivation = true;
|
2023-12-20 03:47:22 -05:00
|
|
|
|
|
|
|
# remote building
|
2023-12-29 16:51:52 -05:00
|
|
|
trusted-users = ["matt" "nixremote"];
|
2023-10-15 13:30:21 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-04-18 14:37:46 -04:00
|
|
|
programs.nh = {
|
2023-10-20 12:12:37 -04:00
|
|
|
enable = true;
|
2024-04-18 14:37:46 -04:00
|
|
|
package = nh.packages.${pkgs.system}.default;
|
|
|
|
|
2023-10-20 12:12:37 -04:00
|
|
|
# weekly cleanup
|
|
|
|
clean = {
|
|
|
|
enable = true;
|
|
|
|
extraArgs = "--keep-since 30d";
|
|
|
|
};
|
2023-11-19 15:32:28 -05:00
|
|
|
};
|
2023-10-20 12:12:37 -04:00
|
|
|
|
2023-11-30 17:01:46 -05:00
|
|
|
services = {
|
|
|
|
fwupd.enable = true;
|
|
|
|
|
2024-02-05 06:40:53 -05:00
|
|
|
xserver.xkb = {
|
2023-11-30 17:01:46 -05:00
|
|
|
layout = "ca";
|
2024-02-05 06:40:53 -05:00
|
|
|
variant = "multix";
|
2023-11-30 17:01:46 -05:00
|
|
|
};
|
2023-10-17 17:53:10 -04:00
|
|
|
};
|
|
|
|
|
2024-06-28 21:47:11 -04:00
|
|
|
boot.supportedFilesystems = ["ext4" "xfs" "btrfs" "vfat" "ntfs"];
|
2024-08-31 19:16:06 -04:00
|
|
|
system.fsPackages = builtins.attrValues {
|
|
|
|
inherit
|
|
|
|
(pkgs)
|
|
|
|
btrfs-progs
|
|
|
|
nfs-utils
|
|
|
|
ntfs3g
|
|
|
|
xfsprogs
|
|
|
|
;
|
|
|
|
};
|
2024-06-28 21:47:11 -04:00
|
|
|
|
2024-07-31 15:50:51 -04:00
|
|
|
environment.variables.NPM_CONFIG_GLOBALCONFIG = "/etc/npmrc";
|
|
|
|
environment.etc.npmrc.text = ''
|
|
|
|
fund = false
|
|
|
|
update-notifier = false
|
|
|
|
'';
|
|
|
|
|
2024-09-12 13:30:14 -04:00
|
|
|
environment.systemPackages = builtins.attrValues {
|
|
|
|
# Peripherals
|
|
|
|
inherit
|
|
|
|
(pkgs)
|
|
|
|
hdparm
|
|
|
|
pciutils
|
|
|
|
usbutils
|
|
|
|
rar
|
|
|
|
;
|
|
|
|
};
|
|
|
|
|
|
|
|
home-manager.users = let
|
2024-01-09 13:13:04 -05:00
|
|
|
inherit (config.vars) mainUser;
|
2024-01-04 03:39:14 -05:00
|
|
|
|
2023-10-15 14:30:30 -04:00
|
|
|
default = {
|
|
|
|
imports = [
|
2023-12-08 12:48:48 -05:00
|
|
|
# Make the vars be the same on Nix and HM
|
2024-03-26 15:32:48 -04:00
|
|
|
{
|
2024-09-05 08:17:23 -04:00
|
|
|
options.vars = mkOption {
|
|
|
|
type = types.attrs;
|
2024-03-26 15:32:48 -04:00
|
|
|
readOnly = true;
|
|
|
|
default = config.vars;
|
|
|
|
};
|
|
|
|
}
|
2023-12-08 12:48:48 -05:00
|
|
|
|
2024-04-22 15:14:22 -04:00
|
|
|
{
|
2024-11-17 22:13:59 -05:00
|
|
|
programs.bash = {
|
|
|
|
sessionVariables = rec {
|
|
|
|
FLAKE = config.environment.variables.FLAKE;
|
|
|
|
NH_FLAKE = FLAKE;
|
|
|
|
};
|
|
|
|
shellAliases.nh = "env -u FLAKE nh";
|
2024-04-22 15:14:22 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-12-01 03:07:17 -05:00
|
|
|
./home
|
2023-12-23 22:57:43 -05:00
|
|
|
./home/trash-d
|
2023-10-15 14:30:30 -04:00
|
|
|
];
|
2023-10-15 15:31:49 -04:00
|
|
|
|
2024-09-05 08:17:23 -04:00
|
|
|
home.stateVersion = config.system.stateVersion;
|
2023-10-15 14:30:30 -04:00
|
|
|
};
|
|
|
|
in {
|
2024-09-12 13:30:14 -04:00
|
|
|
root = default;
|
|
|
|
greeter = mkIf (config.services.greetd.enable) default;
|
|
|
|
${mainUser} = default;
|
2023-10-15 14:30:30 -04:00
|
|
|
};
|
2023-10-15 14:43:23 -04:00
|
|
|
}
|