Modernizing overlay

This commit is contained in:
Natsu Kagami 2022-07-04 15:41:04 -04:00
parent 53a04459c2
commit c9ee01f65e
Signed by: nki
GPG key ID: 7306B3D3C3AD6E51
4 changed files with 41 additions and 53 deletions

View file

@ -16,27 +16,12 @@ with lib;
];
homebrew.brews = [
# Base libraries
"coreutils"
# Compilers and Language Interpreters
"elm"
"llvm"
"luajit-openresty"
"node"
"perl"
"ruby@2.7"
# CLI tools
"pinentry-mac" # UI for Pin Entry on gpg Mac
# U2F
"pam-u2f"
] ++ (optionals (pkgs.system == "aarch64-darwin") [
# Because python on Nix is a bit abababa
"python@3.9"
"scipy"
]);
];
homebrew.casks = [
"anki"

View file

@ -16,7 +16,7 @@
# Auto upgrade nix package and the daemon service.
# services.nix-daemon.enable = true;
nix.package = pkgs.nixUnstable;
nix.package = pkgs.nixFlakes;
# Create /etc/bashrc that loads the nix-darwin environment.
programs.zsh.enable = true; # default shell on catalina
@ -25,9 +25,6 @@
## Networking related settings
networking.hostName = "nki-macbook";
## Programs
nixpkgs.config.allowUnfree = true;
environment.variables = {
EDITOR = ""; # don't set it by default

View file

@ -29,10 +29,13 @@
outputs = { self, darwin, nixpkgs, nixpkgs-unstable, home-manager, deploy-rs, sops-nix, nur, ... }@inputs:
let
overlayForSystem = import ./overlay.nix inputs;
overlays = import ./overlay.nix inputs;
nixpkgsAsRegistry = { ... }: {
nix.registry.nixpkgs.flake = nixpkgs;
pkgs = system: import nixpkgs { inherit system overlays; };
pkgs-unstable = system: import nixpkgs-unstable { inherit system overlays; };
nixpkgsAsRegistry_ = stable: { ... }: {
nix.registry.nixpkgs.flake = stable;
nix.registry.nixpkgs-unstable.flake = nixpkgs-unstable;
nix.nixPath = [
"nixpkgs=${nixpkgs}"
@ -40,6 +43,17 @@
"/nix/var/nix/profiles/per-user/root/channels"
];
};
nixpkgsAsRegistry = nixpkgsAsRegistry_ nixpkgs;
haskellDotNix = { ... }: {
# Binary Cache for Haskell.nix
nix.binaryCachePublicKeys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];
nix.binaryCaches = [
"https://cache.iog.io"
];
};
enableOsuStable = { lib, ... }: {
imports = [ inputs.nix-gaming.nixosModules.pipewireLowLatency ];
@ -63,31 +77,26 @@
in
{
# MacBook configuration: nix-darwin + home-manager
darwinConfigurations."nki-macbook" = darwin.lib.darwinSystem {
darwinConfigurations."nki-macbook" = darwin.lib.darwinSystem rec {
system = "aarch64-darwin";
pkgs = pkgs-unstable system;
modules = [
./darwin/configuration.nix
# Set nix path
({ ... }: {
nix.nixPath = [
"nixpkgs=${nixpkgs-unstable}"
"nixpkgs-unstable=${nixpkgs-unstable}"
"/nix/var/nix/profiles/per-user/root/channels"
"\$HOME/.nix-defexpr/channels"
];
})
haskellDotNix
(nixpkgsAsRegistry_ nixpkgs-unstable)
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.nki = import ./home/macbook-home.nix;
}
(overlayForSystem "aarch64-darwin")
];
};
# Home configuration
nixosConfigurations."nki-home" = nixpkgs.lib.nixosSystem {
nixosConfigurations."nki-home" = nixpkgs.lib.nixosSystem rec {
pkgs = pkgs system;
system = "x86_64-linux";
modules = [
./modules/my-tinc
@ -102,11 +111,11 @@
home-manager.users.nki = import ./home/kagami-pc-home.nix;
}
inputs.secrets.nixosModules.x86_64-linux.common
(overlayForSystem "x86_64-linux")
];
};
# x1c1 configuration
nixosConfigurations."nki-x1c1" = nixpkgs.lib.nixosSystem {
nixosConfigurations."nki-x1c1" = nixpkgs.lib.nixosSystem rec {
pkgs = pkgs system;
system = "x86_64-linux";
modules = [
./modules/my-tinc
@ -119,12 +128,12 @@
home-manager.useUserPackages = true;
home-manager.users.nki = import ./home/nki-x1c1.nix;
}
(overlayForSystem "x86_64-linux")
];
};
# DigitalOcean node
nixosConfigurations."nki-personal-do" = nixpkgs.lib.nixosSystem {
nixosConfigurations."nki-personal-do" = nixpkgs.lib.nixosSystem rec {
pkgs = pkgs system;
system = "x86_64-linux";
modules = [
./modules/my-tinc
@ -132,7 +141,6 @@
sops-nix.nixosModules.sops
./nki-personal-do/configuration.nix
inputs.secrets.nixosModules.x86_64-linux.nki-personal-do
(overlayForSystem "x86_64-linux")
];
};
deploy.nodes."nki-personal-do" = {

View file

@ -1,28 +1,26 @@
{ nixpkgs, nixpkgs-unstable, nur, ... }@inputs: system:
{ nixpkgs, nixpkgs-unstable, nur, ... }@inputs:
let
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable { config.allowUnfree = true; system = prev.system; };
unfree = import nixpkgs { config.allowUnfree = true; system = prev.system; };
x86 = import nixpkgs-unstable { system = "${system}"; config.allowUnsupportedSystem = true; };
x86 = import nixpkgs-unstable { system = prev.system; config.allowUnsupportedSystem = true; };
};
overlay-needs-unstable = final: prev: {
# override some packages that needs unstable that cannot be changed in the setup.
nix-direnv = prev.unstable.nix-direnv;
};
overlay-imported = final: prev: {
rnix-lsp = inputs.rnix-lsp.defaultPackage."${system}";
rnix-lsp = inputs.rnix-lsp.defaultPackage."${prev.system}";
};
in
{
nixpkgs.overlays = [
(import ./overlays/openrazer)
overlay-unstable
overlay-needs-unstable
overlay-imported
nur.overlay
[
(import ./overlays/openrazer)
overlay-unstable
overlay-needs-unstable
overlay-imported
nur.overlay
# Bug fixes
(import ./overlays/bugfixes/delta)
]; # we assign the overlay created before to the overlays of nixpkgs.
}
# Bug fixes
(import ./overlays/bugfixes/delta)
] # we assign the overlay created before to the overlays of nixpkgs.