nixos-configs/common/default.nix

154 lines
2.9 KiB
Nix
Raw Normal View History

2023-11-22 15:33:16 -05:00
{
config,
2023-12-03 04:50:17 -05:00
home-manager,
lib,
2023-11-22 15:33:16 -05:00
nh,
nix-melt,
nurl,
pkgs,
2024-06-15 22:51:36 -04:00
self,
2023-11-22 15:33:16 -05:00
...
}: {
2023-10-15 14:43:23 -04:00
imports = [
./vars
./modules
./packages.nix
self.nixosModules.borgbackup
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;
2024-06-28 13:40:52 -04:00
systemd.services.nix-daemon = {
environment.TMPDIR = "/home/nix-cache";
2024-06-28 13:40:52 -04:00
preStart = ''
mkdir -p ${config.systemd.services.nix-daemon.environment.TMPDIR}
'';
};
nix = {
2024-07-24 21:58:37 -04:00
package = pkgs.nixVersions.nix_2_23;
# Edit nix.conf
settings = {
# Store
keep-outputs = true;
keep-derivations = true;
auto-optimise-store = true;
# Commands
experimental-features = ["nix-command" "flakes"];
http-connections = 0; # unlimited for local cache
warn-dirty = false;
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
trusted-users = ["matt" "nixremote"];
};
};
2024-04-18 14:37:46 -04:00
programs.nh = {
enable = true;
2024-04-18 14:37:46 -04:00
package = nh.packages.${pkgs.system}.default;
# weekly cleanup
clean = {
enable = true;
extraArgs = "--keep-since 30d";
};
2023-11-19 15:32:28 -05:00
};
2023-11-30 17:01:46 -05:00
services = {
fwupd.enable = true;
xserver.xkb = {
2023-11-30 17:01:46 -05:00
layout = "ca";
variant = "multix";
2023-11-30 17:01:46 -05:00
};
};
boot.supportedFilesystems = ["ext4" "xfs" "btrfs" "vfat" "ntfs"];
system.fsPackages = with pkgs; [
btrfs-progs
nfs-utils
ntfs3g
xfsprogs
];
2024-07-31 15:50:51 -04:00
environment.variables.NPM_CONFIG_GLOBALCONFIG = "/etc/npmrc";
environment.etc.npmrc.text = ''
fund = false
update-notifier = false
'';
environment.systemPackages =
(with pkgs; [
# Peripherals
hdparm
pciutils
usbutils
])
++ [
nix-melt.packages.${pkgs.system}.default
(nurl.packages.${pkgs.system}.default.override {
nix = config.nix.package;
})
];
home-manager = let
2024-06-15 22:51:36 -04:00
inherit (lib) mapAttrs' nameValuePair;
inherit (config.vars) mainUser;
2024-01-04 03:39:14 -05:00
mainUserConf = config.home-manager.users.${mainUser};
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
{
options.vars = lib.mkOption {
type = lib.types.attrs;
readOnly = true;
default = config.vars;
};
}
2023-12-08 12:48:48 -05:00
{
programs.bash.sessionVariables = {
FLAKE = config.environment.variables.FLAKE;
};
}
./home
2023-12-23 22:57:43 -05:00
./home/trash-d
2023-10-15 14:30:30 -04:00
];
2024-06-15 22:51:36 -04:00
# Cache devShells
2024-06-16 11:31:26 -04:00
home.file = mapAttrs' (n: v:
nameValuePair ".cache/devShells/${n}" {
source = v;
})
self.devShells.${pkgs.system};
2023-10-15 14:30:30 -04:00
};
in {
users = {
root =
default
// {
home.stateVersion = mainUserConf.home.stateVersion;
};
greeter =
lib.mkIf (config.services.greetd.enable)
(default
// {
home.stateVersion = mainUserConf.home.stateVersion;
});
${mainUser} = default;
};
2023-10-15 14:30:30 -04:00
};
2023-10-15 14:43:23 -04:00
}