1
0
Fork 0
mirror of https://github.com/ryanccn/flake.git synced 2025-12-06 08:10:43 +01:00

refactor: split system into modules

This commit is contained in:
Ryan Cao 2023-08-30 23:45:37 +08:00
parent 3a7c130767
commit 8c087c0eb3
Signed by: ryanccn
SSH key fingerprint: SHA256:NtP/BlVhoQq4xU6BEcZeT8nIPvHntkJ3lIc2yB+F09E
8 changed files with 182 additions and 164 deletions

36
flake.lock generated
View file

@ -71,11 +71,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1692750383, "lastModified": 1693163878,
"narHash": "sha256-n5P5HOXuu23UB1h9PuayldnRRVQuXJLpoO+xqtMO3ws=", "narHash": "sha256-HXuyMUVaRSoIA602jfFuYGXt6AMZ+WUxuvLq8iJmYTA=",
"owner": "ipetkov", "owner": "ipetkov",
"repo": "crane", "repo": "crane",
"rev": "ef5d11e3c2e5b3924eb0309dba2e1fea2d9062ae", "rev": "43db881168bc65b568d36ceb614a0fc8b276191b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -86,11 +86,11 @@
}, },
"darwin-custom-icons": { "darwin-custom-icons": {
"locked": { "locked": {
"lastModified": 1693056564, "lastModified": 1693410124,
"narHash": "sha256-hFZVorJ0jdTDqM0DKArtOyMIxVX14oNpqG+58j3WLKg=", "narHash": "sha256-DXjBumqDVHoTgB4JOZeDWMhYpgHmk9qoSziYFLclfL0=",
"owner": "ryanccn", "owner": "ryanccn",
"repo": "nix-darwin-custom-icons", "repo": "nix-darwin-custom-icons",
"rev": "7001db539da6247a18e9021c2d387f72db005466", "rev": "9095bdc551000d789ea0e829c98ec3d5c7a9e9d9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -106,11 +106,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1692089279, "lastModified": 1693198521,
"narHash": "sha256-4OcROiMbf+YF41n+KPx3cqiHs2KoY7pdDGyCvJow1p8=", "narHash": "sha256-xhH3T6j9JvT1UDLM1QJmtwrjJpA4MoZx2hPxJLrin7w=",
"owner": "ryanccn", "owner": "ryanccn",
"repo": "discord-applemusic-rich-presence", "repo": "discord-applemusic-rich-presence",
"rev": "f257c32c794ef6b09cddcaaa7be27a1f74d9683d", "rev": "42d98b6d99a32ca5075b10c61e3446af97af7c8f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -160,11 +160,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1692763155, "lastModified": 1693399033,
"narHash": "sha256-qMrGKZ8c/q/mHO3ZdrcBPwiVVXPLLgXjY98Ejqb5kAA=", "narHash": "sha256-yXhiMo8MnE86sGtPIHAKaLHhmhe8v9tqGGotlUgKJvY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "6a20e40acaebf067da682661aa67da8b36812606", "rev": "f5c15668f9842dd4d5430787d6aa8a28a07f7c10",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -195,11 +195,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1692934111, "lastModified": 1693355128,
"narHash": "sha256-9EEE59v/esKNMR5zKbLRV9NoRPYvERw5jHQOnfr47bk=", "narHash": "sha256-+ZoAny3ZxLcfMaUoLVgL9Ywb/57wP+EtsdNGuXUJrwg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1e44a037bbf4fcaba041436e65e87be88f3f495b", "rev": "a63a64b593dcf2fe05f7c5d666eb395950f36bc9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -262,11 +262,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1693015707, "lastModified": 1693361441,
"narHash": "sha256-SFr93DYn502sVT9nB5U8/cKg1INyEk/jCeq8tHioz7Y=", "narHash": "sha256-TRFdMQj9wSKMduNqe/1xF8TzcPWEdcn/hKWcVcZ5fO8=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "e90223633068a44f0fb62374e0fa360ccc987292", "rev": "1fb2aa49635e9f30b6fa211ab7c454f7175e1ba3",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -58,7 +58,9 @@
inputs.flake-compat.follows = "flake-compat"; inputs.flake-compat.follows = "flake-compat";
}; };
darwin-custom-icons.url = "github:ryanccn/nix-darwin-custom-icons"; darwin-custom-icons = {
url = "github:ryanccn/nix-darwin-custom-icons";
};
flake-utils = { flake-utils = {
url = "github:numtide/flake-utils"; url = "github:numtide/flake-utils";
@ -83,12 +85,9 @@
home-manager.darwinModules.home-manager home-manager.darwinModules.home-manager
darwin-custom-icons.darwinModules.default darwin-custom-icons.darwinModules.default
./system.nix ./system.nix
./users.nix
]; ];
specialArgs = { specialArgs = {inherit inputs;};
inherit inputs;
};
}; };
}; };
} }

31
modules/homebrew.nix Normal file
View file

@ -0,0 +1,31 @@
_: {
environment.variables = {
HOMEBREW_NO_ANALYTICS = "1";
HOMEBREW_NO_INSECURE_REDIRECT = "1";
HOMEBREW_NO_EMOJI = "1";
};
homebrew = {
enable = true;
caskArgs.require_sha = true;
onActivation = {
autoUpdate = true;
cleanup = "uninstall";
upgrade = true;
};
casks = let
noQuarantine = name: {
inherit name;
args = {no_quarantine = true;};
};
in [
"blackhole-16ch"
(noQuarantine "eloston-chromium")
"sf-symbols"
"1password/tap/1password-cli"
];
taps = ["1password/tap"];
};
}

35
modules/nix.nix Normal file
View file

@ -0,0 +1,35 @@
{
pkgs,
inputs,
...
}: {
services.nix-daemon.enable = true;
nix.package = pkgs.nix;
nix.settings = {
experimental-features = "nix-command flakes";
build-users-group = "nixbld";
trusted-users = ["ryanccn"];
auto-optimise-store = true;
extra-platforms = ["x86_64-darwin" "aarch64-darwin"];
extra-substituters = [
"https://nix-community.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
nixpkgs = {
overlays = [
inputs.attic.overlays.default
inputs.discord-applemusic-rich-presence.overlays.default
inputs.nyoom.overlays.default
(import ../overlays/ryan-mono-bin.nix)
];
config.allowUnfree = true;
hostPlatform = "aarch64-darwin";
};
}

75
modules/packages.nix Normal file
View file

@ -0,0 +1,75 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
nil
statix
alejandra
nixpkgs-fmt
nix-melt
attic-client
cachix
direnv
rustc
cargo
sccache
fnm
deno
bun
(python311.withPackages (ps: with ps; [pip]))
yt-dlp
xkcdpass
pipreqs
libffi
openssl
rust-analyzer
nodePackages.typescript-language-server
rustfmt
clippy
dprint
age
bat
btop
cloudflared
doggo
doppler
du-dust
fd
ffmpeg
flyctl
fzf
gh
gen-license
gum
hyperfine
jq
just
mkcert
nerdfix
pscale
railway
ripgrep
silicon
tealdeer
tokei
vhs
vivid
watchexec
xh
zoxide
typst
packwiz
catppuccin-catwalk
nyoom
spicetify-cli
exiftool
];
}

View file

@ -4,8 +4,8 @@ _: {
goPath = ".go"; goPath = ".go";
}; };
home.file."Library/Application Support/go/env".text = '' home.sessionVariables = {
GOTOOLCHAIN=path GOTOOLCHAIN = "path";
GOPROXY=direct GOPROXY = "direct";
''; };
} }

View file

@ -3,109 +3,12 @@
inputs, inputs,
... ...
}: { }: {
environment.systemPackages = with pkgs; [ imports = [
nil ./modules/nix.nix
alejandra ./modules/packages.nix
nixpkgs-fmt ./modules/homebrew.nix
attic-client
statix
cachix
direnv
rustc
cargo
sccache
deno
fnm
bun
(python311.withPackages (ps:
with ps; [
pip
yt-dlp
xkcdpass
]))
libffi
openssl
rust-analyzer
nodePackages.typescript-language-server
rustfmt
clippy
dprint
age
bat
btop
cloudflared
doggo
doppler
du-dust
fd
ffmpeg
flyctl
fzf
gh
gen-license
gum
hyperfine
jq
just
mkcert
nerdfix
pscale
railway
ripgrep
silicon
tealdeer
tokei
vhs
vivid
watchexec
xh
zoxide
typst
packwiz
catppuccin-catwalk
nyoom
spicetify-cli
exiftool
]; ];
services.nix-daemon.enable = true;
nix.package = pkgs.nix;
nix.settings = {
experimental-features = "nix-command flakes";
build-users-group = "nixbld";
trusted-users = ["ryanccn"];
auto-optimise-store = true;
extra-platforms = ["x86_64-darwin" "aarch64-darwin"];
extra-substituters = [
"https://nix-community.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
nixpkgs = {
overlays = [
inputs.attic.overlays.default
inputs.discord-applemusic-rich-presence.overlays.default
inputs.nyoom.overlays.default
(import ./overlays/ryan-mono-bin.nix)
];
config.allowUnfree = true;
hostPlatform = "aarch64-darwin";
};
system.activationScripts.extraActivation = { system.activationScripts.extraActivation = {
text = '' text = ''
set -eo pipefail set -eo pipefail
@ -128,28 +31,20 @@
programs.fish.enable = true; programs.fish.enable = true;
programs.zsh.enable = true; programs.zsh.enable = true;
homebrew = { home-manager = {
enable = true; useGlobalPkgs = true;
caskArgs.require_sha = true; useUserPackages = true;
onActivation = {
autoUpdate = true; extraSpecialArgs = {
cleanup = "uninstall"; ctpModule = inputs.catppuccin.homeManagerModules.catppuccin;
upgrade = true; discord-applemusic-rich-presence = inputs.discord-applemusic-rich-presence.homeManagerModules.default;
}; };
casks = let users.ryanccn = import ./home.nix;
noQuarantine = name: {
inherit name;
args = {no_quarantine = true;};
}; };
in [
"blackhole-16ch"
(noQuarantine "eloston-chromium")
"sf-symbols"
"1password/tap/1password-cli"
];
taps = ["1password/tap"]; users.users.ryanccn = {
home = "/Users/ryanccn";
}; };
system.stateVersion = 4; system.stateVersion = 4;

View file

@ -1,17 +0,0 @@
{inputs, ...}: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
ctpModule = inputs.catppuccin.homeManagerModules.catppuccin;
discord-applemusic-rich-presence = inputs.discord-applemusic-rich-presence.homeManagerModules.default;
};
users.ryanccn = import ./home.nix;
};
users.users.ryanccn = {
home = "/Users/ryanccn";
};
}