feat: Add basic nixos configuration

This commit is contained in:
Louis Gallet 2024-10-19 18:19:43 +02:00
commit 4707d50b1a
Signed by: lgallet
GPG Key ID: 84D3DF1528A84511
2 changed files with 300 additions and 0 deletions

167
flake.lock generated Normal file
View File

@ -0,0 +1,167 @@
{
"nodes": {
"brew-src": {
"flake": false,
"locked": {
"lastModified": 1727016223,
"narHash": "sha256-iZqd91Cp4O02BU6/eBZ0UZgJN8AlwH+0geQUpqF176E=",
"owner": "Homebrew",
"repo": "brew",
"rev": "916044581862c32fc2365e8e9ff0b1507a98925e",
"type": "github"
},
"original": {
"owner": "Homebrew",
"ref": "4.3.24",
"repo": "brew",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1728901530,
"narHash": "sha256-I9Qd0LnAsEGHtKE9+uVR0iDFmsijWSy7GT0g3jihG4Q=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "a60ac02f9466f85f092e576fd8364dfc4406b5a6",
"type": "github"
},
"original": {
"owner": "LnL7",
"repo": "nix-darwin",
"type": "github"
}
},
"nix-darwin_2": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"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",
"flake-utils": "flake-utils",
"nix-darwin": "nix-darwin_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1728153462,
"narHash": "sha256-jOF15LIzDf7SIkbjzhKq9nlnkS1aFTUCiIo92ipXMY4=",
"owner": "zhaofengli-wip",
"repo": "nix-homebrew",
"rev": "86af3bb8f7d365eb496ef5553646ec2fe06a3662",
"type": "github"
},
"original": {
"owner": "zhaofengli-wip",
"repo": "nix-homebrew",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1687274257,
"narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=",
"path": "/nix/store/22qgs3skscd9bmrxv9xv4q5d4wwm5ppx-source",
"rev": "2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"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_3": {
"locked": {
"lastModified": 1729265718,
"narHash": "sha256-4HQI+6LsO3kpWTYuVGIzhJs1cetFcwT7quWCk/6rqeo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ccc0c2126893dd20963580b6478d1a10a4512185",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nix-darwin": "nix-darwin",
"nix-homebrew": "nix-homebrew",
"nixpkgs": "nixpkgs_3"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

133
flake.nix Normal file
View File

@ -0,0 +1,133 @@
{
description = "Example Darwin system flake";
inputs = {
nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nix-darwin, nixpkgs, nix-homebrew, ... }:
let
configuration = { pkgs, ... }: {
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages =
[
pkgs.termdown
pkgs.fastfetch
pkgs.neovim
];
homebrew = {
enable = true;
casks = [
"firefox"
"arc"
"cyberduck"
"discord"
"gpg-suite-no-mail"
"iina"
"jetbrains-toolbox"
"keka"
"maccy"
"nordvpn"
"notion"
"plex"
"swish"
"termius"
"tower"
"warp"
];
brews = [
"wget"
"act"
"bear"
"cmake"
"deno"
"firebase-cli"
"git"
"git-flow"
"git-lfs"
"gnupg"
"gtk+3"
"llvm@18"
"nvm"
"pinentry-mac"
"pinentry"
"pnpm"
"sdl2"
"sdl2_image"
"sdl2_ttf"
"terraform"
"tmux"
"tree"
"wget"
"zsh"
"yubikey-agent"
];
taps = [
"hashicorp/tap"
];
onActivation.cleanup = "uninstall";
onActivation.autoUpdate = true;
onActivation.upgrade = true;
};
# Allow broken packages
nixpkgs.config.allowBroken = true;
# allow unfree packages
nixpkgs.config.allowUnfree = true;
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
# nix.package = pkgs.nix;
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
# Create /etc/zshrc that loads the nix-darwin environment.
programs.zsh.enable = true; # default shell on catalina
# programs.fish.enable = true;
# Set Git commit hash for darwin-version.
system.configurationRevision = self.rev or self.dirtyRev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 5;
# The platform the configuration will be used on.
nixpkgs.hostPlatform = "aarch64-darwin";
};
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#simple
darwinConfigurations."MBP-Louis" = nix-darwin.lib.darwinSystem {
modules = [
configuration
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
# Install Homebrew under the default prefix
enable = true;
# Apple Silicon Only: Also install Homebrew under the default Intel prefix for Rosetta 2
enableRosetta = true;
# User owning the Homebrew prefix
user = "louisgallet";
# Automatically migrate existing Homebrew installations
autoMigrate = true;
};
}
];
};
# Expose the package set, including overlays, for convenience.
darwinPackages = self.darwinConfigurations."MBP-Louis".pkgs;
};
}