From a1791816d1ee45a39f85cd4c5fef18c5ee4f0b16 Mon Sep 17 00:00:00 2001 From: Zeusina Date: Sun, 5 Jul 2026 11:19:59 +0300 Subject: [PATCH] feat: add initial commit with flake --- flake.lock | 97 ++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 208 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4cdeb0f --- /dev/null +++ b/flake.lock @@ -0,0 +1,97 @@ +{ + "nodes": { + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1781761792, + "narHash": "sha256-rCPytmKNjctLloB6UgK5CRrHSwV4b0ygxtJLPPp8R14=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "a1fa429e945becaf60468600daf649be4ba0350c", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1782175435, + "narHash": "sha256-EMzXKmnOtBQ2MnvpiNOm7E+kOMvdPrIKaeg52Tip2Uk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "89570f24e97e614aa34aa9ab1c927b6578a43775", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1781577229, + "narHash": "sha256-rcUHdUtJEvMdNEl2Wq+YpHraHKfcer3KsBscpZEF2Yg=", + "rev": "567a49d1913ce81ac6e9582e3553dd90a955875f", + "type": "tarball", + "url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1017464.567a49d1913c/nixexprs.tar.xz" + }, + "original": { + "type": "tarball", + "url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz" + } + }, + "root": { + "inputs": { + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs", + "spicetify-nix": "spicetify-nix" + } + }, + "spicetify-nix": { + "inputs": { + "nixpkgs": "nixpkgs_2", + "systems": "systems" + }, + "locked": { + "lastModified": 1782031037, + "narHash": "sha256-a7oWSyS7SN81UOqVt481yIEMDsMpaJ7GNdV6Eaz5Yqg=", + "owner": "Gerg-L", + "repo": "spicetify-nix", + "rev": "9cb27462cfd20edac174353f1e95bc03aa888863", + "type": "github" + }, + "original": { + "owner": "Gerg-L", + "repo": "spicetify-nix", + "type": "github" + } + }, + "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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d1e92c0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,111 @@ +{ + description = "Example nix-darwin system flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + nix-darwin.url = "github:nix-darwin/nix-darwin/master"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + spicetify-nix.url = "github:Gerg-L/spicetify-nix"; + }; + + outputs = inputs @ { + self, + nix-darwin, + nixpkgs, + spicetify-nix, + }: let + systems = ["x86_64-linux" "aarch64-darwin"]; + forAllSystems = nixpkgs.lib.genAttrs systems; + configuration = {pkgs, ...}: { + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = [ + pkgs.starship + pkgs.zoxide + pkgs.fzf + pkgs.fastfetch + pkgs.htop + pkgs.btop + pkgs.eza + pkgs.git + ]; + + homebrew = { + enable = true; + onActivation = { + # Автоматически обновлять Homebrew и формулы + autoUpdate = true; + upgrade = true; + + # САМАЯ ВАЖНАЯ ОПЦИЯ ДЛЯ ВАШЕЙ ЗАДАЧИ: + # "uninstall" - удаляет пакеты (brews) и приложения (casks), которых нет в конфиге. + # "zap" - делает то же самое, но дополнительно подчищает хвосты (файлы настроек) от Casks. + cleanup = "zap"; + }; + + casks = [ + "nextcloud" + "google-chrome" + "bitwarden" + "localsend" + # "tor-browser" + "iterm2" + # "spotify" + "qbittorrent" + "obsidian" + "visual-studio-code" + "ayugram" + "equinox" + ]; + }; + + nix.gc = { + automatic = true; + # Запускать в воскресенье (Weekday = 0) в 2:00 ночи + interval = { + Weekday = 0; + Hour = 2; + Minute = 0; + }; + options = "--delete-older-than 7d"; + }; + + nix.optimise.automatic = true; + + programs.spicetify = let + spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.hostPlatform.system}; + in { + enable = true; + enabledExtensions = with spicePkgs.extensions; [ + adblock + beautiful-lyrics + ]; + }; + + # Necessary for using flakes on this system. + nix.settings.experimental-features = "nix-command flakes"; + system.primaryUser = "kirill"; + + # 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 = 6; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = "aarch64-darwin"; + nixpkgs.config.allowUnfree = true; + }; + in { + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); + # Build darwin flake using: + # $ darwin-rebuild build --flake .#simple + darwinConfigurations."MacBook-Pro-Kirill" = nix-darwin.lib.darwinSystem { + modules = [ + configuration + inputs.spicetify-nix.darwinModules.default + ]; + }; + }; +}