Compare commits

...

3 Commits

Author SHA1 Message Date
00eb9d49b3
common/nix: chanage nixpkgs flake to github ref
This makes it so flake.lock files produced by `nix flake lock` don't
reference my personal Nix store, but upstream Nixpkgs
2024-02-14 10:41:15 +01:00
4adc24b8bf
Add nix.nix with nix-related options 2024-02-14 10:33:09 +01:00
26085edbc6
base.nix: make some stuff mkDefault 2024-02-14 10:11:01 +01:00
3 changed files with 77 additions and 17 deletions

View File

@ -5,5 +5,6 @@
./me.nix
./remote.nix
./wm.nix
./nix.nix
];
}

65
system/common/nix.nix Normal file
View File

@ -0,0 +1,65 @@
{ pkgs, lib, config, options, inputs, ... }:
let
cfg = config.nixfiles.common.nix;
in
{
options.nixfiles.common.nix = {
enable = lib.mkEnableOption "common Nix configuration";
registerNixpkgs = lib.mkOption {
type = lib.types.bool;
default = cfg.enable;
example = "true";
description = "Whether to register the Nixpkgs revision used by Nixfiles to the system's flake registry and make it tye system's <nixpkgs> channel";
};
/* # TODO
register = lib.mkOption {
type = lib.types.bool;
default = cfg.enable;
example = "true";
description = "Whether to register Nixfiles to the system's flake registry";
};
*/
};
config = lib.mkMerge [
( lib.mkIf cfg.registerNixpkgs {
# this makes modern nix tools use the system's version of nixpkgs
nix.registry = {
nixpkgs = {
exact = true;
from = {
id = "nixpkgs";
type = "indirect";
};
# used instead of `flake` option so produced flake.lock files are
# portable
to = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
rev = "${inputs.nixpkgs.rev}";
};
};
};
# this makes comma and legacy nix utils use the flake nixpkgs for ABI
# compatibility becasue once `, vkcube` couldn't find the correct opengl
# driver or something (also it reduces the download size of temporary shell
# closures)
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ] ++ options.nix.nixPath.default;
})
( lib.mkIf cfg.enable {
# direnv is a tool to automatically load shell environments upon entering
# a directory. nix-direnv has an extensionn to keep nix shells in the
# system's gcroots so shells can be used after a gc without rebuilding.
programs.direnv.enable = lib.mkDefault true;
# fallback to building locally if binary cache fails (home-manager should be
# able to handle simple rebuilds offline)
nix.settings.fallback = lib.mkDefault true;
})
];
}

View File

@ -11,24 +11,24 @@ in
config = lib.mkMerge [
(lib.mkIf cfg.enable {
# Enable my account
nixfiles.common.me.enable = lib.mkDefault true;
nixfiles.common = {
# Enable my account
me.enable = lib.mkDefault true;
# Enable system Nix configuration
nix.enable = lib.mkDefault true;
};
# locale settings
i18n = {
defaultLocale = "en_US.UTF-8";
defaultLocale = lib.mkDefault "en_US.UTF-8";
extraLocaleSettings = {
LC_ALL = "en_US.UTF-8";
LC_ALL = lib.mkDefault "en_US.UTF-8";
};
};
# Enable flakes
nix.settings.experimental-features = ["nix-command" "flakes" ];
# fallback to building locally if binary cache fails (home-manager should be
# able to handle simple rebuilds offline)
nix.settings.fallback = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
@ -81,16 +81,10 @@ in
sops
];
programs.neovim.defaultEditor = true;
programs.neovim.defaultEditor = lib.mkDefault true;
# this makes comma and legacy nix utils use the flake nixpkgs for ABI
# compatibility becasue once `, vkcube` couldn't find the correct opengl
# driver or something (also it reduces the download size of temporary shell
# closures)
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ] ++ options.nix.nixPath.default;
programs.ssh.enableAskPassword = false;
programs.fuse.userAllowOther = true;
programs.ssh.enableAskPassword = lib.mkDefault false;
programs.fuse.userAllowOther = lib.mkDefault true;
programs.gnupg.agent = {
enable = lib.mkDefault true;