refactor(nix): Mix stable and unstable packages

Also replace inkscape with brew cask inkscape on macOS
This commit is contained in:
Ahmad Ansori Palembani 2024-11-02 10:06:35 +07:00
parent 90c0934bf2
commit 26c9cfbaed
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
13 changed files with 133 additions and 72 deletions

43
.config/nix/flake.lock generated
View file

@ -26,7 +26,7 @@
"nix-darwin"
],
"nixpkgs": [
"nixpkgs"
"nixpkgs-stable"
]
},
"locked": {
@ -83,7 +83,7 @@
"firefox-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
"nixpkgs-stable"
]
},
"locked": {
@ -177,7 +177,7 @@
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
"nixpkgs-unstable"
]
},
"locked": {
@ -198,7 +198,7 @@
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
"nixpkgs-stable"
]
},
"locked": {
@ -237,23 +237,23 @@
"type": "github"
}
},
"nixpkgs": {
"nixpkgs-stable": {
"locked": {
"lastModified": 1730272153,
"narHash": "sha256-B5WRZYsRlJgwVHIV6DvidFN7VX7Fg9uuwkRW9Ha8z+w=",
"lastModified": 1730503127,
"narHash": "sha256-RRidUbyqCiFgFfJ5VbvuEVl2j2+p89QPmSyplID7VQM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53",
"rev": "acc2a23c96439823bc751e726b62a44d80cf76ee",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-24.05",
"repo": "nixpkgs",
"rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53",
"type": "github"
}
},
"nixpkgs-stable": {
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
@ -269,6 +269,22 @@
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1730272153,
"narHash": "sha256-B5WRZYsRlJgwVHIV6DvidFN7VX7Fg9uuwkRW9Ha8z+w=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
@ -277,7 +293,7 @@
"system-manager",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1728092656,
@ -300,7 +316,8 @@
"firefox-darwin": "firefox-darwin",
"home-manager": "home-manager",
"nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-unstable": "nixpkgs-unstable",
"system-manager": "system-manager"
}
},
@ -332,7 +349,7 @@
"flake-utils": "flake-utils_2",
"nix-vm-test": "nix-vm-test",
"nixpkgs": [
"nixpkgs"
"nixpkgs-stable"
],
"pre-commit-hooks": "pre-commit-hooks",
"rust-overlay": "rust-overlay",

View file

@ -1,7 +1,7 @@
{
description = "null2264's Nix Setup";
outputs = inputs@{ self, nix-darwin, nixpkgs, home-manager, system-manager, ... }:
outputs = inputs@{ self, nix-darwin, nixpkgs-stable, nixpkgs-unstable, home-manager, system-manager, ... }:
let
vars = {
floorp = {
@ -13,42 +13,43 @@
{
darwinConfigurations = (
import ./systems/darwin {
inherit (nixpkgs) lib;
inherit inputs nixpkgs nix-darwin home-manager vars;
inherit (nixpkgs-unstable) lib;
inherit inputs nixpkgs-stable nixpkgs-unstable nix-darwin home-manager vars;
}
);
systemConfigs = ( # sudo is required, sadly
import ./systems/nix {
inherit (nixpkgs) lib;
inherit inputs nixpkgs system-manager home-manager vars;
inherit (nixpkgs-unstable) lib;
inherit inputs nixpkgs-stable nixpkgs-unstable system-manager home-manager vars;
}
);
homeConfigurations = (
import ./users {
inherit (nixpkgs) lib;
inherit inputs nixpkgs home-manager vars;
inherit (nixpkgs-unstable) lib;
inherit inputs nixpkgs-stable nixpkgs-unstable home-manager vars;
}
);
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53";
nixpkgs-stable.url = "github:NixOS/nixpkgs/release-24.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53";
nix-darwin = {
url = "github:LnL7/nix-darwin/470f87c1827b51169ed4f91cdbdfd48417bfff3d";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
firefox-darwin = {
url = "github:bandithedoge/nixpkgs-firefox-darwin";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
brew-nix = {
url = "github:BatteredBunny/brew-nix/d3d3a2666e5330e83b6a64b1eb3e1e9380f6da9b";
inputs.nix-darwin.follows = "nix-darwin";
inputs.brew-api.follows = "brew-api";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
brew-api = {
url = "github:BatteredBunny/brew-api";
@ -57,12 +58,12 @@
home-manager = {
url = "github:nix-community/home-manager/64c6325b28ebd708653dd41d88f306023f296184";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs.follows = "nixpkgs-unstable"; # we need unstable (24.11) for programs.floorp. FIXME: switch to stable once 24.11 become stable
};
system-manager = {
url = "github:numtide/system-manager/c93e62f2e962b54fd961798731d25eaa5778dbe2";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, pkgs-unstable, ... }:
let
custom = {
@ -8,11 +8,13 @@ let
py.dnspython
]));
};
custom.inkscape = if pkgs.stdenv.isDarwin then pkgs.brewCasks.inkscape else (pkgs.inkscape.override { python3 = custom.python; });
in {
inherit custom;
packages = [
pkgs.zsh
pkgs.home-manager
pkgs.zoxide
custom.inkscape
];
}

View file

@ -1,9 +1,17 @@
system: nixpkgs: extraOverlays:
{ arch, stable, unstable, extraOverlays ? [] }:
{
system = system;
pkgs = import nixpkgs {
inherit system;
system = arch;
pkgs = import stable {
system = arch;
overlays =
[
(import ../overlays/python.nix)
] ++ extraOverlays;
config.allowUnfree = true;
};
pkgs-unstable = import unstable {
system = arch;
overlays =
[
(import ../overlays/python.nix)

View file

@ -7,13 +7,15 @@ let
dontCheck = true;
});
in {
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [(pyfinal: pyprev: {
dnspython = (disablePyChecks pyprev.dnspython).overridePythonAttrs (old: {
disabledTests = [
"test_resolver" # Relying too much on internet connection, Indonesian internet couldn't cope with it
] ++ old.disabledTests;
});
pillow = disablePyChecks pyprev.pillow; # Inconsistent test result
cherrypy = disablePyChecks pyprev.cherrypy; # Inconsistent test result
})];
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
(pyfinal: pyprev: {
dnspython = (disablePyChecks pyprev.dnspython).overridePythonAttrs (old: {
disabledTests = [
"test_resolver" # Relying too much on internet connection, Indonesian internet couldn't cope with it
] ++ old.disabledTests;
});
pillow = disablePyChecks pyprev.pillow; # Inconsistent test result
cherrypy = disablePyChecks pyprev.cherrypy; # Inconsistent test result
})
];
}

View file

@ -1,4 +1,4 @@
{ pkgs, config, vars, common, inputs, ... }:
{ pkgs, pkgs-unstable, config, vars, common, inputs, ... }:
{
# I don't want to risk breaking my hackintosh setup in case Apple decided to
@ -17,7 +17,6 @@
pkgs.gnupg
pkgs.htop-vim
common.custom.python
(pkgs.inkscape.override { python3 = common.custom.python; })
#(pkgs.poetry.override { python3 = common.custom.python; })
pkgs.fastfetch
pkgs.eza

View file

@ -1,4 +1,4 @@
{ inputs, nixpkgs, nix-darwin, vars, ... }:
{ inputs, nixpkgs-stable, nixpkgs-unstable, nix-darwin, vars, ... }:
let
mkCommon = import ../../lib/mkCommon.nix;
@ -14,16 +14,21 @@ in
"ThiccBook-Pro" =
let
inherit (
mkSystem "x86_64-darwin" nixpkgs [
inputs.firefox-darwin.overlay
inputs.brew-nix.overlays.default
]
) system pkgs;
common = (mkCommon pkgs);
mkSystem {
arch = "x86_64-darwin";
stable = nixpkgs-stable;
unstable = nixpkgs-unstable;
extraOverlays = [
inputs.firefox-darwin.overlay
inputs.brew-nix.overlays.default
];
}
) system pkgs pkgs-unstable;
common = (mkCommon { inherit pkgs pkgs-unstable; });
in
nix-darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit inputs pkgs vars common; };
specialArgs = { inherit inputs pkgs pkgs-unstable vars common; };
modules = [
./configuration.nix
];
@ -33,16 +38,21 @@ in
MacBookProM1 =
let
inherit (
mkSystem "aarch64-darwin" nixpkgs [
inputs.firefox-darwin.overlay
inputs.brew-nix.overlays.default
]
) system pkgs;
common = (mkCommon pkgs);
mkSystem {
arch = "aarch64-darwin";
stable = nixpkgs-stable;
unstable = nixpkgs-unstable;
extraOverlays = [
inputs.firefox-darwin.overlay
inputs.brew-nix.overlays.default
];
}
) system pkgs pkgs-unstable;
common = (mkCommon { inherit pkgs pkgs-unstable; });
in
nix-darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit inputs pkgs vars common; };
specialArgs = { inherit inputs pkgs pkgs-unstable vars common; };
modules = [
./configuration.nix
];

View file

@ -1,4 +1,4 @@
{ inputs, nixpkgs, system-manager, vars, ... }:
{ inputs, nixpkgs-stable, nixpkgs-unstable, system-manager, vars, ... }:
let
mkCommon = import ../../lib/mkCommon.nix;
@ -7,11 +7,17 @@ in
{
"potato" =
let
inherit (mkSystem "x86_64-linux" nixpkgs []) system pkgs;
common = (mkCommon pkgs);
inherit (
mkSystem {
arch = "x86_64-linux";
stable = nixpkgs-stable;
unstable = nixpkgs-unstable;
}
) system pkgs pkgs-unstable;
common = (mkCommon { inherit pkgs pkgs-unstable; });
in
system-manager.lib.makeSystemConfig {
extraSpecialArgs = { inherit inputs pkgs vars common; };
extraSpecialArgs = { inherit inputs pkgs pkgs-unstable vars common; };
modules = [
./potato
];

View file

@ -1,4 +1,4 @@
{ pkgs, config, vars, common, ... }:
{ pkgs, pkgs-unstable, config, vars, common, ... }:
{
config = {

View file

@ -1,4 +1,4 @@
{ inputs, nixpkgs, home-manager, vars, ... }:
{ inputs, nixpkgs-stable, nixpkgs-unstable, home-manager, vars, ... }:
let
mkSystem = import ../lib/mkSystem.nix;
@ -18,13 +18,23 @@ in
"ziro@ThiccBook-Pro" =
let
inherit (mkSystem "x86_64-darwin" nixpkgs [inputs.firefox-darwin.overlay]) system pkgs;
inherit (
mkSystem {
arch = "x86_64-darwin";
stable = nixpkgs-stable;
unstable = nixpkgs-unstable;
extraOverlays = [
inputs.firefox-darwin.overlay
inputs.brew-nix.overlays.default
];
}
) system pkgs pkgs-unstable;
vars.name = "ziro";
vars.floorp.verticalTabHoverWidthInEm = 28;
in
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs pkgs home-manager vars; };
pkgs = pkgs-unstable; # FIXME: switch to stable when 24.11 become stable
extraSpecialArgs = { inherit inputs pkgs pkgs-unstable home-manager vars; };
modules = [
./ziro
./ziro/darwin.nix
@ -34,12 +44,18 @@ in
"ziro@potato" =
let
inherit (mkSystem "x86_64-linux" nixpkgs []) system pkgs;
inherit (
mkSystem {
arch = "x86_64-linux";
stable = nixpkgs-stable;
unstable = nixpkgs-unstable;
}
) system pkgs pkgs-unstable;
vars.name = "ziro";
in
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit inputs pkgs home-manager vars; };
pkgs = pkgs-unstable; # FIXME: switch to stable when 24.11 become stable
extraSpecialArgs = { inherit inputs pkgs pkgs-unstable home-manager vars; };
modules = [
./ziro
./ziro/linux.nix

View file

@ -1,4 +1,4 @@
{ pkgs, config, vars, ... }:
{ pkgs, pkgs-unstable, config, vars, ... }:
{
home.homeDirectory = "/Users/ziro";

View file

@ -1,4 +1,4 @@
{ pkgs, config, vars, ... }:
{ pkgs, pkgs-unstable, config, vars, ... }:
{
home = {

View file

@ -1,4 +1,4 @@
{ pkgs, config, vars, ... }:
{ pkgs, pkgs-unstable, config, vars, ... }:
{
home.homeDirectory = "/home/ziro";