commit 294739594d3a850dc0a7c7a0a9fbf587f69ec6f8 Author: RGBCube Date: Wed May 3 11:53:50 2023 +0300 Rewrite everything diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..235a754 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +[*.nix] +end_of_line = lf +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..08a8397 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +* + +!machines/ +!machines/asus/ +!machines/asus/docker/ +!machines/asus/git/ +!machines/asus/neovim/ +!machines/asus/networkmanager/ +!machines/asus/nixpkgs/ +!machines/asus/nushell/ +!machines/asus/pipewire/ +!machines/asus/users/ +# !machines/asus/plasma/ +!machines/asus/system/ +!machines/asus/xserver/ + +!.editorconfig +!.gitignore + +!*.md +!*.nu +!*.nix +!*.sh diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..14b90d4 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2023-present RGBCube + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2efa120 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# My NixOS Configuration + + + +## License + +``` +MIT License + +Copyright (c) 2023-present RGBCube + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +``` diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5aa13cb --- /dev/null +++ b/flake.nix @@ -0,0 +1,71 @@ +{ + description = "My NixOS configuration."; + + nixConfig = { + extra-experimental-features = '' + nix-command + flakes + ''; + extra-substituters = "https://nix-community.cachix.org"; + extra-trusted-public-keys = "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="; + }; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + +# plasma-manager = { +# url = "github:pjones/plasma-manager"; # Add "inputs.plasma-manager.homeManagerModules.plasma-manager" to the home-manager.users.${user}.imports +# inputs.nixpkgs.follows = "nixpkgs"; +# inputs.home-manager.follows = "home-manager"; +# }; + }; + + outputs = { + nixpkgs, + home-manager, +# plasma-manager, + ... + }: + let + lib = nixpkgs.lib; + + importConfiguration = directory: lib.nixosSystem { + specialArgs = { + inherit lib; # plasma-manager; + + pkgs = import nixpkgs { + config.allowUnfree = true; + }; + + homeManagerConfiguration = attrs: + let + userName = import (directory + "user-name.nix"); + in + { + home-manager.users.${userName} = attrs; + }; + }; + + nixosConfigurations.${basename directory} = { + modules = [ + directory + { + networking.hostName = basename directory; + } + + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + } + ]; + }; + }; + in + builtins.foldl lib.recursiveUpdate (builtins.map importConfiguration (builtins.readDir ./machines)); +} diff --git a/link.sh b/link.sh new file mode 100644 index 0000000..fcb28e8 --- /dev/null +++ b/link.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +sudo true + +echo "* Cleaning /etc/nixos" +sudo rm -rf /etc/nixos +sudo mkdir /etc/nixos + +echo "* Linking files" +sudo ln ./flake.nix /etc/nixos/flake.nix +sudo ln ./flake.lock /etc/nixos/flake.nix + +sudo ln -s ./system-configuration /etc/nixos/ +sudo ln -s ./home-configuration /etc/nixos/ diff --git a/machines/asus/default.nix b/machines/asus/default.nix new file mode 100644 index 0000000..acdb89a --- /dev/null +++ b/machines/asus/default.nix @@ -0,0 +1,27 @@ +{ homeManagerConfiguration, ... }: + +{ + system.stateVersion = "22.11"; + + imports = [ + ./docker + ./git + ./neovim + ./networkmanager + ./nixpkgs + ./nushell + ./pipewire +# ./plasma + ./system + ./users + ./xserver + ]; +} + +# // +# +# (homeManagerConfiguration { +# imports = [ +# plasma-manager.homeManagerModules.plasma-manager +# ]; +# }) diff --git a/machines/asus/docker/default.nix b/machines/asus/docker/default.nix new file mode 100644 index 0000000..0582d99 --- /dev/null +++ b/machines/asus/docker/default.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + virtualisation.docker.enable = true; +} diff --git a/machines/asus/git/default.nix b/machines/asus/git/default.nix new file mode 100644 index 0000000..8cc06b6 --- /dev/null +++ b/machines/asus/git/default.nix @@ -0,0 +1,11 @@ +{ homeManagerConfiguration, ... }: + +homeManagerConfiguration { + programs.git.enable = true; + programs.git = { + userName = "RGBCube"; + userEmail = "RGBCube@users.noreply.github.com"; + + config.init.defaultBranch = "master"; + }; +} diff --git a/machines/asus/neovim/default.nix b/machines/asus/neovim/default.nix new file mode 100644 index 0000000..38c7bc7 --- /dev/null +++ b/machines/asus/neovim/default.nix @@ -0,0 +1,19 @@ +{ homeManagerConfiguration, ... }: + +homeManagerConfiguration { + # Nuking nano out of orbit. + environment.defaultPackages = []; + programs.nano.syntaxHighlight = false; + + programs.neovim.enable = true; + programs.neovim = { + defaultEditor = true; + + viAlias = true; + vimAlias = true; + + plugins = [ + # lunarVim + ]; + }; +} diff --git a/machines/asus/networkmanager/default.nix b/machines/asus/networkmanager/default.nix new file mode 100644 index 0000000..6e2a390 --- /dev/null +++ b/machines/asus/networkmanager/default.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + networking.networkmanager.enable = true; +} diff --git a/machines/asus/nixpkgs/default.nix b/machines/asus/nixpkgs/default.nix new file mode 100644 index 0000000..918f0cb --- /dev/null +++ b/machines/asus/nixpkgs/default.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: + +{ + nixpkgs.hostPlatform = "x86_64-linux"; + + environment.systemPackages = import ./packages.nix pkgs; + fonts.fonts = import ./fonts.nix pkgs; +} diff --git a/machines/asus/nixpkgs/fonts.nix b/machines/asus/nixpkgs/fonts.nix new file mode 100644 index 0000000..2148d89 --- /dev/null +++ b/machines/asus/nixpkgs/fonts.nix @@ -0,0 +1,5 @@ +pkgs: with pkgs; [] + +++ [ (nerdfonts.override { fonts = [ # NERD FONTS + "JetBrainsMono" +]; }) ] diff --git a/machines/asus/nixpkgs/packages.nix b/machines/asus/nixpkgs/packages.nix new file mode 100644 index 0000000..a658853 --- /dev/null +++ b/machines/asus/nixpkgs/packages.nix @@ -0,0 +1,55 @@ +pkgs: with pkgs; [] + +++ [ # EDITORS + # neovim # Declared in neovim/. + jetbrains.idea-ultimate +] + +++ [ # VERSION CONTROL + # git # Declared in git/. +] + +++ [ # SHELLS + # nushell # Declared in nushell/. + starship +] + +++ [ # DEVELOPMENT TOOLS + # docker # Declared in docker/. + bat +] + +++ [ # MISCELLANEOUS + htop + neofetch +] + +++ [ # PYTHON + (python311.withPackages (pkgs: with pkgs; [ + pip + requests + ])) + virtualenv + poetry +] + +++ [ # APPLICATIONS + firefox + discord + qbittorrent + lightly-qt +] + +++ [ # LIBREOFFICE + libreoffice + hunspellDicts.en_US + hunspellDicts.en_GB-ize +] + +++ [ # GAMES + openttd +] + +++ [ # EMULATION + wine +] diff --git a/machines/asus/nushell/config.nu b/machines/asus/nushell/config.nu new file mode 100644 index 0000000..d502630 --- /dev/null +++ b/machines/asus/nushell/config.nu @@ -0,0 +1,399 @@ +let theme = { + filesize: {|e| + if $e == 0b { + 'white' + } else if $e < 1mb { + 'cyan' + } else { 'blue' } + } + + date: {|| (date now) - $in | + if $in < 1hr { + 'red3b' + } else if $in < 6hr { + 'orange3' + } else if $in < 1day { + 'yellow3b' + } else if $in < 3day { + 'chartreuse2b' + } else if $in < 1wk { + 'green3b' + } else if $in < 6wk { + 'darkturquoise' + } else if $in < 52wk { + 'deepskyblue3b' + } else { 'dark_gray' } + } + + bool: {|| + if $in { + 'light_cyan' + } else { + 'light_gray' + } + } + + leading_trailing_space_bg: { attr: n } + + empty: blue + hints: dark_gray + header: green_bold + row_index: green_bold + separator: white + duration: white + int: white + range: white + float: white + string: white + nothing: white + binary: white + cellpath: white + record: white + list: white + block: white + + shape_garbage: { fg: "#FFFFFF" bg: "#FF0000" attr: b} + shape_matching_brackets: { attr: u } + shape_and: purple_bold + shape_binary: purple_bold + shape_block: blue_bold + shape_bool: light_cyan + shape_custom: green + shape_datetime: cyan_bold + shape_directory: cyan + shape_external: cyan + shape_externalarg: green_bold + shape_filepath: cyan + shape_flag: blue_bold + shape_float: purple_bold + shape_globpattern: cyan_bold + shape_int: purple_bold + shape_internalcall: cyan_bold + shape_list: cyan_bold + shape_match_pattern: green + shape_literal: blue + shape_nothing: light_cyan + shape_operator: yellow + shape_or: purple_bold + shape_pipe: purple_bold + shape_range: yellow_bold + shape_record: cyan_bold + shape_redirection: purple_bold + shape_signature: green_bold + shape_string: green + shape_string_interpolation: cyan_bold + shape_table: blue_bold + shape_variable: purple +} + + +let-env config = { + show_banner: false + + ls: { + use_ls_colors: true + clickable_links: true + } + + rm: { + always_trash: false + } + + cd: { + abbreviations: false + } + + table: { + mode: rounded + index_mode: always + show_empty: true + trim: { + methodology: wrapping + wrapping_try_keep_words: true + truncating_suffix: "..." + } + } + + explore: { + help_banner: true + exit_esc: true + command_bar_text: '#C4C9C6' + status_bar_background: {fg: '#1D1F21' bg: '#C4C9C6' } + highlight: {bg: 'yellow' fg: 'black' } + + table: { + split_line: '#404040' + cursor: true + line_index: true + line_shift: true + line_head_top: true + line_head_bottom: true + show_head: true + show_index: true + } + + config: { + cursor_color: {bg: 'yellow' fg: 'black' } + } + } + + history: { + max_size: 10000 + sync_on_enter: true + file_format: "plaintext" + } + + completions: { + case_sensitive: false + quick: true + partial: true + algorithm: "prefix" + external: { + enable: true + max_results: 100 + completer: null + } + } + + filesize: { + metric: true + format: "auto" + } + + cursor_shape: { + vi_insert: block + vi_normal: underscore + } + + color_config: $theme + use_grid_icons: true + footer_mode: "25" + float_precision: 2 + use_ansi_coloring: true + edit_mode: vi + shell_integration: false + render_right_prompt_on_last_line: false + + hooks: { + display_output: {|| + if (term size).columns >= 100 { table -e } else { table } + } + } + + menus: [ + { + name: completion_menu + only_buffer_difference: false + marker: "| " + type: { + layout: columnar + columns: 4 + col_width: 20 + col_padding: 2 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } + { + name: history_menu + only_buffer_difference: true + marker: "? " + type: { + layout: list + page_size: 10 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } + { + name: help_menu + only_buffer_difference: true + marker: "? " + type: { + layout: description + columns: 4 + col_width: 20 + col_padding: 2 + selection_rows: 4 + description_rows: 10 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } + { + name: commands_menu + only_buffer_difference: false + marker: "# " + type: { + layout: columnar + columns: 4 + col_width: 20 + col_padding: 2 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + source: { |buffer, position| + $nu.scope.commands + | where name =~ $buffer + | each { |it| {value: $it.name description: $it.usage} } + } + } + { + name: vars_menu + only_buffer_difference: true + marker: "# " + type: { + layout: list + page_size: 10 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + source: { |buffer, position| + nu.scope.vars + | where name =~ $buffer + | sort-by name + | each { |it| {value: $it.name description: $it.type} } + } + } + { + name: commands_with_description + only_buffer_difference: true + marker: "# " + type: { + layout: description + columns: 4 + col_width: 20 + col_padding: 2 + selection_rows: 4 + description_rows: 10 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + source: { |buffer, position| + $nu.scope.commands + | where name =~ $buffer + | each { |it| {value: $it.name description: $it.usage} } + } + } + ] + + keybindings: [ + { + name: completion_menu + modifier: none + keycode: tab + mode: [emacs vi_normal vi_insert] + event: { + until: [ + { send: menu name: completion_menu } + { send: menunext } + ] + } + } + { + name: completion_previous + modifier: shift + keycode: backtab + mode: [vi_normal, vi_insert] + event: { send: menuprevious } + } + { + name: history_menu + modifier: control + keycode: char_r + mode: emacs + event: { send: menu name: history_menu } + } + { + name: next_page + modifier: control + keycode: char_x + mode: emacs + event: { send: menupagenext } + } + { + name: undo_or_previous_page + modifier: control + keycode: char_z + mode: emacs + event: { + until: [ + { send: menupageprevious } + { edit: undo } + ] + } + } + { + name: yank + modifier: control + keycode: char_y + mode: emacs + event: { + until: [ + {edit: pastecutbufferafter} + ] + } + } + { + name: unix-line-discard + modifier: control + keycode: char_u + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {edit: cutfromlinestart} + ] + } + } + { + name: kill-line + modifier: control + keycode: char_k + mode: [emacs, vi_normal, vi_insert] + event: { + until: [ + {edit: cuttolineend} + ] + } + } + { + name: commands_menu + modifier: control + keycode: char_t + mode: [emacs, vi_normal, vi_insert] + event: { send: menu name: commands_menu } + } + { + name: vars_menu + modifier: alt + keycode: char_o + mode: [emacs, vi_normal, vi_insert] + event: { send: menu name: vars_menu } + } + { + name: commands_with_description + modifier: control + keycode: char_s + mode: [emacs, vi_normal, vi_insert] + event: { send: menu name: commands_with_description } + } + ] +} diff --git a/machines/asus/nushell/default.nix b/machines/asus/nushell/default.nix new file mode 100644 index 0000000..7f12dff --- /dev/null +++ b/machines/asus/nushell/default.nix @@ -0,0 +1,29 @@ +{ homeManagerConfiguration, ... }: + +homeManagerConfiguration { + programs.nushell.enable = true; + programs.nushell = { + configFile.source = ./config.nu; + envFile.source = ./env.nu; + + shellAliases = { + g = "git"; + ga = "git add"; + gb = "git branch"; + gc = "git commit -m"; + gca = "git commit --amend"; + gcl = "git clone"; + gp = "git push"; + grb = "git rebase -i"; + grba = "git rebase --abort"; + gs = "git switch"; + gsm = "git switch master"; + + la = "ls -a"; + sl = "ls"; + + n = "neovim"; + p = "python3"; + }; + }; +} diff --git a/machines/asus/nushell/env.nu b/machines/asus/nushell/env.nu new file mode 100644 index 0000000..501b171 --- /dev/null +++ b/machines/asus/nushell/env.nu @@ -0,0 +1,33 @@ +let-env ENV_CONVERSIONS = { + "PATH": { + from_string: { |s| $s | split row (char esep) | path expand -n } + to_string: { |v| $v | path expand -n | str join (char esep) } + } +} + +let-env NU_LIB_DIRS = [ + ($nu.config-path | path dirname | path join 'scripts') +] + +let-env NU_PLUGIN_DIRS = [ + ($nu.config-path | path dirname | path join 'plugins') +] + +# STARSHIP +let-env config = $env.config | upsert render_right_prompt_on_last_line true + +let-env STARSHIP_SHELL = "nu" +let-env STARSHIP_SESSION_KEY = (random chars -l 16) + +let-env PROMPT_INDICATOR = "" +let-env PROMPT_MULTILINE_INDICATOR = (^/run/current-system/sw/bin/starship prompt --continuation) + +let-env PROMPT_COMMAND = { || + let width = (term size).columns + ^/run/current-system/sw/bin/starship prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)" +} + +let-env PROMPT_COMMAND_RIGHT = { || + let width = (term size).columns + ^/run/current-system/sw/bin/starship prompt --right $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)" +} diff --git a/machines/asus/pipewire/default.nix b/machines/asus/pipewire/default.nix new file mode 100644 index 0000000..2af1f18 --- /dev/null +++ b/machines/asus/pipewire/default.nix @@ -0,0 +1,14 @@ +{ ... }: + +{ + sound.enable = true; + services.pipewire.enable = true; + services.pipewire = { + pulse.enable = true; + + alsa.enable = true; + alsa.support32Bit = true; + }; + + security.rtkit.enable = true; # Needed for PulseAudio. +} diff --git a/machines/asus/plasma/default.nix b/machines/asus/plasma/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/machines/asus/system/boot.nix b/machines/asus/system/boot.nix new file mode 100644 index 0000000..0c87239 --- /dev/null +++ b/machines/asus/system/boot.nix @@ -0,0 +1,22 @@ +{ ... }: + +{ + boot.initrd.availableKernelModules = [ + "ahci" + "sd_mod" + "sr_mod" + "usb_storage" + "usbhid" + "xhci_pci" + ]; + + boot.kernelModules = [ + "kvm-intel" + ]; + + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + efi.efiSysMountPoint = "/boot/efi"; + }; +} diff --git a/machines/asus/system/default.nix b/machines/asus/system/default.nix new file mode 100644 index 0000000..7a4cc3a --- /dev/null +++ b/machines/asus/system/default.nix @@ -0,0 +1,10 @@ +{ ... }: + +{ + imports = [ + ./boot.nix + ./filesystem.nix + ./localisation.nix + ./performance.nix + ]; +} diff --git a/machines/asus/system/filesystem.nix b/machines/asus/system/filesystem.nix new file mode 100644 index 0000000..8db8a79 --- /dev/null +++ b/machines/asus/system/filesystem.nix @@ -0,0 +1,19 @@ +{ ... }: + +{ + fileSystems."/" = { + device = "/dev/disk/by-uuid/d0e4626c-507e-484a-9ecc-94817d889083"; + fsType = "ext4"; + }; + + fileSystems."/boot/efi" = { + device = "/dev/disk/by-uuid/A467-98D1"; + fsType = "vfat"; + }; + + swapDevices = [ + { + device = "/dev/disk/by-uuid/10bfe7d8-1daf-4c65-a5a6-cf3c9a085478"; + } + ]; +} diff --git a/machines/asus/system/localisation.nix b/machines/asus/system/localisation.nix new file mode 100644 index 0000000..d872bdd --- /dev/null +++ b/machines/asus/system/localisation.nix @@ -0,0 +1,21 @@ +{ ... }: + +{ + services.xserver.layout = "tr"; + console.keyMap = "trq"; + + time.timeZone = "Europe/Istanbul"; + + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "tr_TR.UTF-8"; + LC_IDENTIFICATION = "tr_TR.UTF-8"; + LC_MEASUREMENT = "tr_TR.UTF-8"; + LC_MONETARY = "tr_TR.UTF-8"; + LC_NAME = "tr_TR.UTF-8"; + LC_NUMERIC = "tr_TR.UTF-8"; + LC_PAPER = "tr_TR.UTF-8"; + LC_TELEPHONE = "tr_TR.UTF-8"; + LC_TIME = "tr_TR.UTF-8"; + }; +} diff --git a/machines/asus/system/performance.nix b/machines/asus/system/performance.nix new file mode 100644 index 0000000..df49091 --- /dev/null +++ b/machines/asus/system/performance.nix @@ -0,0 +1,5 @@ +{ ... }: + +{ + powerManagement.cpuFreqGovernor = "performance"; +} diff --git a/machines/asus/user-name.nix b/machines/asus/user-name.nix new file mode 100644 index 0000000..5a5aceb --- /dev/null +++ b/machines/asus/user-name.nix @@ -0,0 +1 @@ +"nixos" diff --git a/machines/asus/users/default.nix b/machines/asus/users/default.nix new file mode 100644 index 0000000..1be695b --- /dev/null +++ b/machines/asus/users/default.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +{ + users.defaultShell = pkgs.nushell; + + imports = [ + ./nixos.nix + ]; +} diff --git a/machines/asus/users/nixos.nix b/machines/asus/users/nixos.nix new file mode 100644 index 0000000..9a34ba0 --- /dev/null +++ b/machines/asus/users/nixos.nix @@ -0,0 +1,14 @@ +{ ... }: + +{ + users.users.nixos = { + description = "NixOS"; + isNormalUser = true; + + extraGroups = [ + "wheel" + "networkmanager" + "docker" + ]; + }; +} diff --git a/machines/asus/xserver/default.nix b/machines/asus/xserver/default.nix new file mode 100644 index 0000000..c5eed89 --- /dev/null +++ b/machines/asus/xserver/default.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + services.xserver.enable = true; + services.xserver = { + displayManager.sddm.enable = true; + desktopManager.plasma5.enable = true; + }; +} diff --git a/rebuild.sh b/rebuild.sh new file mode 100755 index 0000000..9dd1111 --- /dev/null +++ b/rebuild.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then + echo "Usage: rebuild.sh [-h | --help] [-c | --clean-garbage]" + exit +fi + +sudo true + +echo -e "\n*** LINKING *** \n" +./link.sh + +echo -e "\n*** REBUILDING SYSTEM ***\n" +sudo nixos-rebuild switch + +if [[ $? != 0 ]]; then + exit 1 +fi + +if [[ $1 != "-c" && $1 != "--clean-garbage" ]]; then + read -p "Clean garbage? [Y/N]: " clean_garbage + + if [[ $clean_garbage =~ ^[Yy]$ ]]; then + nix-collect-garbage -d + fi +else + nix-collect-garbage -d +fi