commit 587333afc21e61447b198dd056fef065044be49e Author: Vegard Bieker Matthey Date: Thu Jul 9 02:13:55 2026 +0200 initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cb30653 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/chown +/sudo +/*:staff +/result diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..a7898d8 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,34 @@ +{ self, pkgs, ... }: { + nix.settings = { + pure-eval = true; + experimental-features = [ + "nix-command" + "flakes" + ]; + }; + + environment.systemPackages = with pkgs; [ + ghostty-bin + ]; + users.users.Vegard = { + shell = pkgs.nushell; + + packages = with pkgs; [ + ripgrep + fd + sops + mosh + nixfmt + ]; + + home = "/Users/Vegard"; + }; + + # 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; + + nixpkgs.hostPlatform = "aarch64-darwin"; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f965338 --- /dev/null +++ b/flake.lock @@ -0,0 +1,153 @@ +{ + "nodes": { + "firefox-addons": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "dir": "pkgs/firefox-addons", + "lastModified": 1783483370, + "narHash": "sha256-BsaOwrDS2lxKDR031CoLyazWjAanP+ZO1Xx3z5NX6DM=", + "owner": "rycee", + "repo": "nur-expressions", + "rev": "2105ea2563f5577187064d91060569f77d30b673", + "type": "gitlab" + }, + "original": { + "dir": "pkgs/firefox-addons", + "owner": "rycee", + "repo": "nur-expressions", + "type": "gitlab" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1782949081, + "narHash": "sha256-vp6Y/Grm98ESt6ceOkWiHWyZRDV3J1RID4w+6NWK9yA=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "17c9d6cdfc60c64f4ee8d306f9bc0b4ccb51481e", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1783525612, + "narHash": "sha256-OEFYdbtG6Qy04KGteknnrx15Uo2XXkYVuUvBvFNEn+Q=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "1aac8895fea6fcabc6a0184c63a80fb2f99fd208", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1783395956, + "narHash": "sha256-AAbexQvDoK+6GFJdhY6kqjA+6ECKRkidgWxkn4gMwAA=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "d5bd9cd77aea4c0a8f49e7fd85545671a208ed15", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1783279667, + "narHash": "sha256-/NAkDSsve+GNM0Bt6tleJdCGfsTlK89nPjkVOzZMo0s=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f205b5574fd0cb7da5b702a2da51507b7f4fdd1b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1783349931, + "narHash": "sha256-aYE76ATiGBg7/cQ2dHASRq97WvNum4OOIPgZ8xIK0QI=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "4fd45857deecb90d2732c87e0315daa48505515e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "root": { + "inputs": { + "firefox-addons": "firefox-addons", + "home-manager": "home-manager", + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1774449309, + "narHash": "sha256-brhZ8DmuGtzkCYHJg4HEd602amKm89Y9ytsFZ5uWD1w=", + "owner": "nix-systems", + "repo": "default", + "rev": "c29398b59d2048c4ab79345812849c9bd15e9150", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "ref": "future-26.11", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..542095f --- /dev/null +++ b/flake.nix @@ -0,0 +1,55 @@ +{ + description = "My nix-darwin flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + nix-darwin.url = "github:nix-darwin/nix-darwin/master"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixvim = { + url = "github:nix-community/nixvim"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + firefox-addons = { + url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + inputs@{ + self, + nix-darwin, + nixpkgs, + home-manager, + nixvim, + firefox-addons, + }: + { + darwinConfigurations."Christines-MacBook-Pro-2" = nix-darwin.lib.darwinSystem { + specialArgs = { inherit self; }; + modules = [ + ./configuration.nix + inputs.home-manager.darwinModules.home-manager + { + home-manager.useUserPackages = true; + home-manager.users.Vegard = ./home/home.nix; + home-manager.extraSpecialArgs = { + inherit + inputs + firefox-addons + nixvim + home-manager + ; + }; + home-manager.sharedModules = [ + inputs.nixvim.homeModules.nixvim + ]; + } + ]; + }; + }; +} diff --git a/home/home.nix b/home/home.nix new file mode 100644 index 0000000..71caa89 --- /dev/null +++ b/home/home.nix @@ -0,0 +1,41 @@ +{ ... }: { + imports = [ + ./programs/neovim.nix + ./programs/librewolf.nix + ]; + home = { + stateVersion = "26.11"; + username = "Vegard"; + sessionVariables = { + EDITOR = "nvim"; + BROWSER = "librewolf"; + }; + }; + + programs.tmux = { + enable = true; + shortcut = "k"; + baseIndex = 1; + keyMode = "vi"; + clock24 = true; + mouse = true; + extraConfig = '' + set-option -sa terminal-overrides "*:RGB" + set -g status-style "bg=default" + set -g window-status-current-style "fg=blue bold" + set -g status-left "" + set-option -g default-terminal "screen-256color" + set-option -g focus-events on + set-option -g status-position top + ''; + }; + + programs.nushell = { + enable = true; + settings = { + show_banner = false; + show_hints = false; + }; + extraConfig = "$env.config.edit_mode = 'vi'"; + }; +} diff --git a/home/programs/librewolf.nix b/home/programs/librewolf.nix new file mode 100644 index 0000000..7db9148 --- /dev/null +++ b/home/programs/librewolf.nix @@ -0,0 +1,213 @@ +{ + pkgs, + firefox-addons, + ... +}: +let + channel = "unstable"; +in +{ + programs.librewolf = { + enable = true; + + profiles.default = { + settings = { + "browser.warnOnQuit" = false; + "browser.urlbar.suggest.bookmark" = false; + "browser.urlbar.suggest.engines" = false; + "browser.urlbar.suggest.history" = false; + "browser.urlbar.suggest.openpage" = false; + "browser.urlbar.suggest.quickactions" = false; + "browser.urlbar.suggest.topsites" = false; + "browser.urlbar.suggest.recentsearches" = false; + "places.history.enabled" = false; + "webgl.disabled" = false; + }; + + extensions.force = true; + extensions.packages = with firefox-addons.packages."aarch64-darwin"; [ + darkreader + bypass-paywalls-clean + return-youtube-dislikes + keepassxc-browser + vimium + ublock-origin + violentmonkey + istilldontcareaboutcookies + sponsorblock + youtube-nonstop + ]; + + search.force = true; + search.engines = { + nix-packages = { + name = "Nix Packages"; + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "channel"; + value = channel; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "np" ]; + }; + + nixos-wiki = { + name = "NixOS Wiki"; + urls = [ + { + template = "https://wiki.nixos.org/w/index.php"; + params = [ + { + name = "channel"; + value = channel; + } + { + name = "search"; + value = "{searchTerms}"; + } + ]; + } + ]; + iconMapObj."16" = "https://wiki.nixos.org/favicon.ico"; + definedAliases = [ "nw" ]; + }; + + nixos-options = { + name = "Nix Options"; + urls = [ + { + template = "https://search.nixos.org/options"; + params = [ + { + name = "type"; + value = "options"; + } + { + name = "channel"; + value = channel; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "no" ]; + }; + + home-manager-options = { + name = "Home Manager Options"; + urls = [ + { + template = "https://home-manager-options.extranix.com"; + params = [ + { + name = "release"; + value = "master"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "ho" ]; + }; + + arch-wiki = { + name = "ArchWiki"; + urls = [ + { + template = "https://wiki.archlinux.org/index.php"; + params = [ + { + name = "search"; + value = "{searchTerms}"; + } + ]; + } + ]; + icon = "https://archlinux.org/static/logos/legacy/arch-legacy-aqua.svg"; + definedAliases = [ "aw" ]; + }; + + rust-docs = { + name = "Docs.rs"; + urls = [ + { + template = "https://docs.rs/releases/search"; + params = [ + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + icon = "https://raw.githubusercontent.com/rust-lang/rust-artwork/refs/heads/master/logo/rust-logo-blk.svg"; + definedAliases = [ "rd" ]; + }; + + rust-crates = { + name = "crates.io"; + urls = [ + { + template = "https://crates.io/search"; + params = [ + { + name = "q"; + value = "{searchTerms}"; + } + ]; + } + ]; + icon = "https://crates.io/assets/cargo.png"; + definedAliases = [ "rc" ]; + }; + + ordbokene = { + name = "Ordbøkene"; + urls = [ + { + template = "https://ordbokene.no/nob/bm,nn/{searchTerms}"; + } + ]; + icon = "https://ordbokene.no/favicon.ico"; + definedAliases = [ "ob" ]; + }; + + pvv-wiki = { + name = "PVV Wiki"; + urls = [ + { + template = "https://wiki.pvv.ntnu.no/w/index.php"; + params = [ + { + name = "search"; + value = "{searchTerms}"; + } + ]; + } + ]; + icon = "https://wiki.pvv.ntnu.no/PNG/PVV-logo.svg"; + definedAliases = [ "pw" ]; + }; + }; + }; + }; +} diff --git a/home/programs/neovim.nix b/home/programs/neovim.nix new file mode 100644 index 0000000..b8b36da --- /dev/null +++ b/home/programs/neovim.nix @@ -0,0 +1,99 @@ +{ lib, ... }: +{ + programs.nixvim = { + enable = true; + dependencies.ripgrep.enable = true; + dependencies.fd.enable = true; + colorschemes.catppuccin.enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + opts = { + number = true; + relativenumber = true; + shiftwidth = 4; + mouse = ""; + }; + globals.mapleader = " "; + lsp = { + servers = { + rust_analyzer = { + enable = true; + }; + lua_ls.enable = true; + nil_ls.enable = true; + tinymist = { + enable = true; + config = { + formatterMode = "typstyle"; + }; + }; + clangd = { + enable = true; + config = { + filetypes = [ "c" ]; + }; + }; + }; + }; + plugins.lsp.enable = true; + # There has been some drama, the repo was archived and stuff. + # plugins.tresitter.enable = true; + plugins.telescope.enable = true; + plugins.fidget.enable = true; + plugins.cmp = { + enable = false; + settings.sources = [ + { name = "nvim_lsp"; } + { name = "path"; } + { name = "buffer"; } + ]; + } + // lib.optionalAttrs (true) { + autoEnableSources = true; + }; + keymaps = [ + { + key = "fg"; + action = "Telescope live_grep"; + } + { + key = "ff"; + action = "Telescope find_files"; + } + ]; + plugins.web-devicons.enable = true; + lsp.keymaps = [ + { + key = "fm"; + lspBufAction = "format"; + } + { + key = "gd"; + lspBufAction = "definition"; + } + { + key = "gD"; + lspBufAction = "references"; + } + { + key = "gt"; + lspBufAction = "type_definition"; + } + { + key = "gi"; + lspBufAction = "implementation"; + } + { + key = "K"; + lspBufAction = "hover"; + } + ]; + } + // lib.optionalAttrs (false) { + plugins.lsp-format = { + enable = true; + lspServersToEnable = "all"; + }; + }; +}