Giter VIP home page Giter VIP logo

nixos-config's Introduction

NixOS Configuration

SSD

# /etc/nixos/configuration.nix 

{ config, pkgs, ... }:

{
  # ...

  # If you are using an SSD it may be useful to enable TRIM support as well as set filesystem flags to improve the SSD performance:
  fileSystems."/".options = [ "noatime" "nodiratime" "discard" ];

}

Zsh

# /etc/nixos/configuration.nix 

{ config, pkgs, ... }:

{
  # ...

  # Zsh
  programs.zsh.enable = true;
  users.users.jakub.shell = pkgs.zsh;
}

Docker

# /etc/nixos/configuration.nix 

{ config, pkgs, ... }:

{
  # ...

  # Docker
  virtualisation.docker.enable = true;
  users.extraGroups.docker.members = [ "jakub" ];
}

Virtualbox

# /etc/nixos/configuration.nix 

{ config, pkgs, ... }:

{
  # ...

  # Virtualbox
  virtualisation.virtualbox.host.enable = true;
  users.extraGroups.vboxusers.members = [ "jakub" ];
}

Printing

# /etc/nixos/configuration.nix 

{ config, pkgs, ... }:

{
  # ...

  # Enable CUPS to print documents.
  services.printing.enable = true;
  services.printing.drivers = [
    pkgs.gutenprint
    pkgs.gutenprintBin
    pkgs.canon-cups-ufr2
  ];

  # https://nixos.wiki/wiki/Printing
  services.avahi = {
    enable = true;
    nssmdns = true;
    openFirewall = true;
  };
}

CUPS

  • driver: IPP Everywhere
  • connection: socket://printer.home

Home manager

Options

Set nix.settings.allowed-users

# /etc/nixos/configuration.nix 

{ config, pkgs, ... }:

{
  # ...

  # Nix settings
  nix.settings = {
    # Enable flakes and new 'nix' command
    experimental-features = "nix-command flakes";
    # Deduplicate and optimize nix store
    auto-optimise-store = true;
    # Allowed users - needed for Home manager
    allowed-users = [ "@wheel" ];
  };
}

Add channel

nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
nix-channel --update

Install Home manage

nix-shell '<home-manager>' -A install

Mininal config

Taken from: https://github.com/Misterio77/nix-starter-configs

User-level systemd services

# ~/.config/home-manager/home.nix
{
  inputs,
  lib,
  config,
  pkgs,
  ...
}: {
  imports = [
    # ...
    ./systemd.nix
  ];
}
# ~/.config/home-manager/systemd.nix
{
  inputs,
  lib,
  config,
  pkgs,
  ...
}: {
  systemd.user.services.foo = {
    Unit = { Description = "Foo service"; };

    Service = {
      Type = "oneshot";
      WorkingDirectory = "/home/jakub/foo-app";
      ExecStart = "/home/jakub/Work/foo-app/foo run";
    };
  };

  systemd.user.timers.foo = {
    Unit = { Description = "Foo timer"; };

    Timer = {
      OnCalendar = "*-*-* *:00:00";
      Unit = "foo.service";
    };

    Install = { WantedBy = [ "timers.target" ]; };
  };
}

nixos-config's People

Contributors

jakubvokoun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.