From 8299fa588c1cce50aa4070202899acf412e84c83 Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Thu, 11 Jul 2024 05:51:07 +0700 Subject: [PATCH] chore: Initial nix config --- .config/nix/.gitignore | 1 + .config/nix/flake.lock | 48 +++++++++++++++++++++++++++ .config/nix/flake.nix | 74 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 .config/nix/.gitignore create mode 100644 .config/nix/flake.lock create mode 100644 .config/nix/flake.nix diff --git a/.config/nix/.gitignore b/.config/nix/.gitignore new file mode 100644 index 0000000..1cd791b --- /dev/null +++ b/.config/nix/.gitignore @@ -0,0 +1 @@ +result/ diff --git a/.config/nix/flake.lock b/.config/nix/flake.lock new file mode 100644 index 0000000..1725ca9 --- /dev/null +++ b/.config/nix/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1720599442, + "narHash": "sha256-jdm+sKVbBXoyrxcHbVaV0htlpq2iFR+eJw3Xe/DPcDo=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "cf297a8d248db6a455b60133f6c0029c04ebe50e", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1720599075, + "narHash": "sha256-0pS6J6Jr7PEkjxkGolrWvilDIlgcEnMHAG9vxPuBeoE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f694c70847dff1a24c29d2ff6b90966fe5619729", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-24.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/.config/nix/flake.nix b/.config/nix/flake.nix new file mode 100644 index 0000000..a19def4 --- /dev/null +++ b/.config/nix/flake.nix @@ -0,0 +1,74 @@ +{ + description = "Example Darwin system flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin"; + nix-darwin.url = "github:LnL7/nix-darwin"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ self, nix-darwin, nixpkgs }: + let + configuration = { pkgs, ... }: { + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = + [ + pkgs.zsh + pkgs.git + pkgs.vim + pkgs.neovim + pkgs.pass + pkgs.passExtensions.pass-otp + pkgs.pinentry_mac + pkgs.gnupg + pkgs.htop-vim + pkgs.poetry + pkgs.python310Full + pkgs.python310Packages.pip + pkgs.python310Packages.tkinter + pkgs.pfetch + pkgs.eza + pkgs.lf + pkgs.wimlib + pkgs.google-cloud-sdk + pkgs.nmap + pkgs.cargo + pkgs.android-tools + # pkgs.browserpass + pkgs.coreutils-full + ]; + + # 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 = 4; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = "x86_64-darwin"; + }; + in + { + # Build darwin flake using: + # $ darwin-rebuild build --flake .#ThiccBook-Pro + darwinConfigurations."ThiccBook-Pro" = nix-darwin.lib.darwinSystem { + modules = [ configuration ]; + }; + + # Expose the package set, including overlays, for convenience. + darwinPackages = self.darwinConfigurations."ThiccBook-Pro".pkgs; + }; +}