Nix hm #1
15 changed files with 468 additions and 144 deletions
162
flake.lock
generated
162
flake.lock
generated
|
|
@ -1,5 +1,38 @@
|
|||
{
|
||||
"nodes": {
|
||||
"brew-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1731323744,
|
||||
"narHash": "sha256-SxUQm4cTHcaoPQHoXe26ZV8cZiMWBGow8MjE4L+MckM=",
|
||||
"owner": "Homebrew",
|
||||
"repo": "brew",
|
||||
"rev": "254bf3fe9d8fa2e1b2fb55dbcf535b2d870180c4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Homebrew",
|
||||
"ref": "4.4.5",
|
||||
"repo": "brew",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1733328505,
|
||||
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
|
|
@ -57,6 +90,85 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1737504076,
|
||||
"narHash": "sha256-/B4XJnzYU/6K1ZZOBIgsa3K4pqDJrnC2579c44c+4rI=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "65cc1fa8e36ceff067daf6cfb142331f02f524d3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "LnL7",
|
||||
"ref": "master",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1716329735,
|
||||
"narHash": "sha256-ap51w+VqG21vuzyQ04WrhI2YbWHd3UGz0e7dc/QQmoA=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "eac4f25028c1975a939c8f8fba95c12f8a25e01c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-homebrew": {
|
||||
"inputs": {
|
||||
"brew-src": "brew-src",
|
||||
"nix-darwin": "nix-darwin_2",
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736041957,
|
||||
"narHash": "sha256-Kk/cVtkxwfHNoB6nINUarMLTtyAEvH+ohzxKBptMzzg=",
|
||||
"owner": "zhaofengli-wip",
|
||||
"repo": "nix-homebrew",
|
||||
"rev": "a6d99cc7436fc18c097b3536d9c45c0548c694c8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "zhaofengli-wip",
|
||||
"repo": "nix-homebrew",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-wsl": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736095716,
|
||||
"narHash": "sha256-csysw/Szu98QDiA2lhWk9seYOyCebeVEWL89zh1cduM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NixOS-WSL",
|
||||
"rev": "63c3b4ed1712a3a0621002cd59bfdc80875ecbb0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "main",
|
||||
"repo": "NixOS-WSL",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1737110817,
|
||||
|
|
@ -74,6 +186,51 @@
|
|||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1687274257,
|
||||
"narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=",
|
||||
"path": "/nix/store/22qgs3skscd9bmrxv9xv4q5d4wwm5ppx-source",
|
||||
"rev": "2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1716330097,
|
||||
"narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5710852ba686cc1fd0d3b8e22b3117d43ba374c2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1733384649,
|
||||
"narHash": "sha256-K5DJ2LpPqht7K76bsxetI+YHhGGRyVteTPRQaIIKJpw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "190c31a89e5eec80dd6604d7f9e5af3802a58a13",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1736883708,
|
||||
"narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=",
|
||||
|
|
@ -93,7 +250,10 @@
|
|||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"neovim": "neovim",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nix-homebrew": "nix-homebrew",
|
||||
"nixos-wsl": "nixos-wsl",
|
||||
"nixpkgs": "nixpkgs_5"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
|
|
|
|||
110
flake.nix
110
flake.nix
|
|
@ -7,25 +7,53 @@
|
|||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
nix-darwin.url = "github:LnL7/nix-darwin/master";
|
||||
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
neovim = {
|
||||
url = "github:LarssonMartin1998/neovim-flake";
|
||||
nix-darwin = {
|
||||
url = "github:LnL7/nix-darwin/master";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
|
||||
neovim.url = "github:LarssonMartin1998/neovim-flake";
|
||||
nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
nix-darwin,
|
||||
nixos-wsl,
|
||||
neovim,
|
||||
nix-homebrew,
|
||||
...
|
||||
}:
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
makeSystemConfig =
|
||||
{
|
||||
name,
|
||||
system,
|
||||
builder,
|
||||
extraModules ? [ ],
|
||||
specialArgs ? { },
|
||||
}:
|
||||
builder {
|
||||
inherit system;
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
modules = [
|
||||
{
|
||||
nix.settings.experimental-features = "nix-command flakes";
|
||||
}
|
||||
./nix/local_system.nix
|
||||
] ++ extraModules;
|
||||
|
||||
specialArgs = specialArgs;
|
||||
};
|
||||
|
||||
makeHomeConfig =
|
||||
{
|
||||
name,
|
||||
|
|
@ -34,14 +62,10 @@
|
|||
}:
|
||||
home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
modules =
|
||||
[
|
||||
./nix/home.nix
|
||||
./nix/local_machine.nix
|
||||
]
|
||||
++ extraModules
|
||||
++ lib.optional (builtins.match ".*-darwin$" system != null) ./nix/darwin.nix
|
||||
++ lib.optional (builtins.match ".*-linux$" system != null) ./nix/linux.nix;
|
||||
modules = [
|
||||
./nix/pkgs/home.nix
|
||||
./nix/local_home.nix
|
||||
] ++ extraModules;
|
||||
|
||||
# Pass neovim-flake to all modules
|
||||
extraSpecialArgs = {
|
||||
|
|
@ -50,29 +74,75 @@
|
|||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
"wsl" = makeSystemConfig {
|
||||
name = "wsl";
|
||||
system = "x86_64-linux";
|
||||
builder = lib.nixosSystem;
|
||||
extraModules = [ ./nix/system/wsl.nix ];
|
||||
specialArgs = {
|
||||
nixos-wsl = nixos-wsl;
|
||||
};
|
||||
};
|
||||
|
||||
"linux-x86" = makeSystemConfig {
|
||||
name = "linux-x86";
|
||||
system = "x86_64-linux";
|
||||
builder = lib.nixosSystem;
|
||||
extraModules = [ ./nix/system/linux.nix ];
|
||||
};
|
||||
|
||||
"linux-aarch" = makeSystemConfig {
|
||||
name = "linux-aarch";
|
||||
system = "aarch64-linux";
|
||||
builder = lib.nixosSystem;
|
||||
extraModules = [ ./nix/system/linux.nix ];
|
||||
};
|
||||
};
|
||||
|
||||
darwinConfigurations."darwin" = makeSystemConfig {
|
||||
name = "darwin";
|
||||
system = "aarch64-darwin";
|
||||
builder = nix-darwin.lib.darwinSystem;
|
||||
extraModules = [
|
||||
./nix/system/darwin.nix
|
||||
nix-homebrew.darwinModules.nix-homebrew
|
||||
{
|
||||
nix-homebrew = {
|
||||
enable = true;
|
||||
enableRosetta = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
specialArgs = {
|
||||
self = self;
|
||||
nix-homebrew = nix-homebrew;
|
||||
};
|
||||
};
|
||||
|
||||
homeConfigurations = {
|
||||
"wsl" = makeHomeConfig {
|
||||
name = "wsl";
|
||||
system = "x86_64-linux";
|
||||
extraModules = [ ./nix/wsl.nix ];
|
||||
extraModules = [ ./nix/pkgs/wsl.nix ];
|
||||
};
|
||||
|
||||
"linux-x86" = makeHomeConfig {
|
||||
name = "linux-x86";
|
||||
system = "x86_64-linux";
|
||||
extraModules = [];
|
||||
extraModules = [ ./nix/pkgs/linux.nix ];
|
||||
};
|
||||
|
||||
"linux-aarch64" = makeHomeConfig {
|
||||
name = "linux-aarch64";
|
||||
"linux-aarch" = makeHomeConfig {
|
||||
name = "linux-aarch";
|
||||
system = "aarch64-linux";
|
||||
extraModules = [];
|
||||
extraModules = [ ./nix/pkgs/linux.nix ];
|
||||
};
|
||||
|
||||
"darwin-aarch64" = makeHomeConfig {
|
||||
name = "darwin-aarch64";
|
||||
"darwin" = makeHomeConfig {
|
||||
name = "darwin";
|
||||
system = "aarch64-darwin";
|
||||
extraModules = [];
|
||||
extraModules = [ ./nix/pkgs/darwin.nix ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
{ pkgs, ... }: {
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
ghostty
|
||||
|
||||
];
|
||||
file = {
|
||||
".config/ghostty".source = ../ghostty;
|
||||
};
|
||||
};
|
||||
}
|
||||
61
nix/home.nix
61
nix/home.nix
|
|
@ -1,61 +0,0 @@
|
|||
{ pkgs, neovim-flake, ... }: {
|
||||
programs = {
|
||||
zsh = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
home = {
|
||||
stateVersion = "24.05";
|
||||
packages = with pkgs; [
|
||||
neovim-flake.packages.${system}.neovim
|
||||
fzf
|
||||
bat
|
||||
git
|
||||
yazi
|
||||
tmux
|
||||
eza
|
||||
curl
|
||||
wget
|
||||
ripgrep
|
||||
fd
|
||||
jq
|
||||
starship
|
||||
fastfetch
|
||||
clang
|
||||
clang-tools
|
||||
nixfmt-rfc-style
|
||||
luajit
|
||||
zoxide
|
||||
rustup
|
||||
zig
|
||||
zls
|
||||
nil
|
||||
lldb
|
||||
gopls
|
||||
delve
|
||||
golangci-lint
|
||||
cmake
|
||||
cmake-language-server
|
||||
cmake-format
|
||||
cmake-lint
|
||||
python313Packages.debugpy
|
||||
pyright
|
||||
lua-language-server
|
||||
gnumake
|
||||
ninja
|
||||
];
|
||||
file = {
|
||||
".zshrc".source = ../zsh/.zshrc;
|
||||
".config/nvim".source = ../nvim;
|
||||
".config/yazi".source = ../yazi;
|
||||
".config/starship.toml".source = ../starship/starship.toml;
|
||||
".tmux.conf".source = ../tmux/.tmux.conf;
|
||||
".config/tmux".source = ../tmux;
|
||||
".config/bat".source = ../bat;
|
||||
".config/ghostty".source = ../ghostty;
|
||||
".config/confutils".source = ../confutils;
|
||||
".config/wallpapers".source = ../wallpapers;
|
||||
};
|
||||
};
|
||||
}
|
||||
12
nix/local_home.nix
Normal file
12
nix/local_home.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ ... }:
|
||||
{
|
||||
# local_home.nix
|
||||
# This is a template file that is committed to git with minimal changes.
|
||||
# In order to use this and remain pure, each machine needs to create a local branch, i.e `machine-wsl` and set these variables
|
||||
# accordingly, and then commit it.
|
||||
home = {
|
||||
# Stub values for demonstration. Override these in local branch.
|
||||
username = "JohnDoe";
|
||||
homeDirectory = "/home/johndoe";
|
||||
};
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
{ ... }: {
|
||||
# local-machine.nix
|
||||
# This is a template file that is committed to git with minimal changes.
|
||||
# In order to use this and remain pure, each machine needs to create a local branch, i.e `machine-wsl` and set these variables
|
||||
# accordingly, and then commit it.
|
||||
home = {
|
||||
# Stub values for demonstration. Override these in local branch.
|
||||
username = "nixos";
|
||||
homeDirectory = "/home/nixos";
|
||||
};
|
||||
}
|
||||
14
nix/local_system.nix
Normal file
14
nix/local_system.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
self,
|
||||
nix-homebrew,
|
||||
...
|
||||
}:
|
||||
{
|
||||
system = {
|
||||
stateVersion = 5;
|
||||
};
|
||||
|
||||
nix-homebrew.user = "larssonmartin1998-mac";
|
||||
}
|
||||
10
nix/pkgs/darwin.nix
Normal file
10
nix/pkgs/darwin.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ pkgs, homebrew, ... }:
|
||||
{
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
gawk
|
||||
];
|
||||
file = {
|
||||
};
|
||||
};
|
||||
}
|
||||
68
nix/pkgs/home.nix
Normal file
68
nix/pkgs/home.nix
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
pkgs,
|
||||
neovim-flake,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs = {
|
||||
zsh = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
home = {
|
||||
stateVersion = "24.05";
|
||||
packages = with pkgs; [
|
||||
neovim-flake.packages.${system}.neovim
|
||||
fzf
|
||||
bat
|
||||
git
|
||||
yazi
|
||||
tmux
|
||||
eza
|
||||
curl
|
||||
wget
|
||||
ripgrep
|
||||
fd
|
||||
jq
|
||||
starship
|
||||
fastfetch
|
||||
clang
|
||||
clang-tools
|
||||
nixfmt-rfc-style
|
||||
luajit
|
||||
zoxide
|
||||
rustup
|
||||
zig
|
||||
zls
|
||||
nil
|
||||
lldb
|
||||
gopls
|
||||
delve
|
||||
golangci-lint
|
||||
cmake
|
||||
cmake-language-server
|
||||
cmake-format
|
||||
cmake-lint
|
||||
python313Packages.debugpy
|
||||
pyright
|
||||
lua-language-server
|
||||
gnumake
|
||||
ninja
|
||||
tldr
|
||||
nerd-fonts.caskaydia-mono
|
||||
];
|
||||
file = {
|
||||
".zshrc".source = ../../zsh/.zshrc;
|
||||
".config/nvim".source = ../../nvim;
|
||||
".config/yazi".source = ../../yazi;
|
||||
".config/starship.toml".source = ../../starship/starship.toml;
|
||||
".tmux.conf".source = ../../tmux/.tmux.conf;
|
||||
".config/tmux".source = ../../tmux;
|
||||
".config/bat".source = ../../bat;
|
||||
".config/ghostty".source = ../../ghostty;
|
||||
".config/confutils".source = ../../confutils;
|
||||
".config/wallpapers".source = ../../wallpapers;
|
||||
};
|
||||
};
|
||||
}
|
||||
58
nix/system/darwin.nix
Normal file
58
nix/system/darwin.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
{
|
||||
system.configurationRevision = self.rev or self.dirtyRev or null;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
home-manager
|
||||
mkalias
|
||||
];
|
||||
|
||||
homebrew = {
|
||||
enable = true;
|
||||
casks = [
|
||||
"ghostty"
|
||||
];
|
||||
brews = [
|
||||
"mas"
|
||||
];
|
||||
masApps = { };
|
||||
onActivation.cleanup = "zap";
|
||||
onActivation.autoUpdate = true;
|
||||
onActivation.upgrade = true;
|
||||
};
|
||||
|
||||
system.defaults = {
|
||||
dock.autohide = true;
|
||||
finder.FXPreferredViewStyle = "clmv";
|
||||
loginwindow.GuestEnabled = false;
|
||||
NSGlobalDomain.AppleICUForce24HourTime = true;
|
||||
NSGlobalDomain.AppleInterfaceStyle = "Dark";
|
||||
NSGlobalDomain.KeyRepeat = 2;
|
||||
};
|
||||
|
||||
system.activationScripts.applications.text =
|
||||
let
|
||||
env = pkgs.buildEnv {
|
||||
name = "system-applications";
|
||||
paths = config.environment.systemPackages;
|
||||
pathsToLink = "/Applications";
|
||||
};
|
||||
in
|
||||
pkgs.lib.mkForce ''
|
||||
# Set up applications
|
||||
echo "setting up /Applications..." >&2
|
||||
rm -rf /Applications/Nix\ Apps
|
||||
mkdir -p /Applications/Nix\ Apps
|
||||
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
|
||||
while read -r src; do
|
||||
app_name=$(basename "$src")
|
||||
echo "copying $src" >&2
|
||||
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
|
||||
done
|
||||
'';
|
||||
}
|
||||
2
nix/system/linux.nix
Normal file
2
nix/system/linux.nix
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
{ ... }: {
|
||||
}
|
||||
7
nix/system/wsl.nix
Normal file
7
nix/system/wsl.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ nixos-wsl, ... }: {
|
||||
imports = [
|
||||
nixosWSL.nixosModules.default
|
||||
];
|
||||
|
||||
wsl.enable = true;
|
||||
}
|
||||
|
|
@ -12,4 +12,10 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
on_attach = function(_, bufnr)
|
||||
vim.notify("TJENA BBY")
|
||||
vim.bo[bufnr].tabstop = 2
|
||||
vim.bo[bufnr].shiftwidth = 2
|
||||
vim.bo[bufnr].softtabstop = 2
|
||||
end
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue