system/nixos/modules/nix.nix
Dmitriy Pleshevskiy dab505e62b nix: use 22.11 stable nixpkgs (#13)
nix: refac overlays

nix: fix path to packages

nix: use mkMerge

nix: rename nixpkgs-unstable input

user: remove my tools

user: build use unstable packages for nil

cannot be built on stable because it requires rustc 1.66 or newer, while the currently active rustc version is 1.64.0

host/magenta: use unstable gitea

nix: fix rollback command

nix: fix overlays

user: use unstable haskell packages to build xmonad

user: don't build woodpecker-cli

host: import nix module for canigou and magenta

pkgs: fix woodpecker

host/home: use unstable kernel to use rtl88x2bu driver

host: use unstable ipfs

move ipfs to shared config

user: use unstable woodpecker-cli

Reviewed-on: #13
2023-03-31 17:40:22 +03:00

68 lines
1.7 KiB
Nix

{ lib, inputs, config, ... }:
let
inherit (builtins) elem;
cfg = config.local.nix;
gitple = "https://git.pleshevski.ru";
mkRegistry = id: url: {
from = { type = "indirect"; inherit id; };
to = { type = "git"; inherit url; };
};
in
{
options.local.nix = with lib; {
enableMyRegistry = mkOption {
type = types.bool;
default = false;
description = "Enable my custom nix registry";
};
allowUnfreePackages = mkOption {
type = types.listOf types.str;
default = [ ];
};
};
config = {
nixpkgs.config.allowUnfreePredicate = lib.mkIf
(cfg.allowUnfreePackages != [ ])
(pkg: elem (lib.getName pkg) cfg.allowUnfreePackages);
nixpkgs.overlays = lib.mkBefore [
inputs.self.overlays.default
(final: prev: {
unstable = import inputs.nixpkgs-unstable {
inherit (config.nixpkgs) config overlays system;
};
})
];
nix = {
settings = {
auto-optimise-store = true;
trusted-users = [ "root" ];
experimental-features = [ "nix-command" "flakes" ];
# To protect nix-shell against garbage collection
# Source: https://github.com/nix-community/nix-direnv#installation
keep-derivations = true;
keep-outputs = true;
};
registry = lib.mkMerge [
{
nixpkgs.flake = inputs.nixpkgs;
nixpkgs-unstable.flake = inputs.nixpkgs-unstable;
}
(lib.mkIf cfg.enableMyRegistry {
templates = mkRegistry "tmpl" "${gitple}/mynix/templates";
tools = mkRegistry "tools" "${gitple}/mynix/tools";
tools_wd2 = mkRegistry "wd2" "${gitple}/pleshevskiy/wd2";
})
];
};
};
}