README.md: Add some useful information

This commit is contained in:
Timothy DeHerrera 2020-12-28 22:15:10 -07:00
parent 11f085e78c
commit 828a939470
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122

View File

@ -34,18 +34,60 @@ Flakes are still new, so not everything works yet. However, it has been to
merged in [nixpkgs][nixpkgs] via [`pkgs.nixFlakes`][nixFlakes]. Thus, this merged in [nixpkgs][nixpkgs] via [`pkgs.nixFlakes`][nixFlakes]. Thus, this
project should be considered _experimental_, until flakes become the default. project should be considered _experimental_, until flakes become the default.
Also, flakes are meant to deprecate nix-channels. It's recommend not to install Also, flakes are meant to deprecate nix-channels. It's recommended not to
any. If your really want them, they should work if you hook them into install any. If your really want them, they should work if you hook them into
`NIX_PATH`. `NIX_PATH`.
# Sharing
One of the great benefits of flakes is the ability to easily share your user
defined packages, modules and other nix expressions without having to merge
anything upstream. In that spirit, everything defined in this flake is usable
from other flakes. So even if you don't want to use this project as a template,
you can still pull in any useful modules, packages or profiles defined here.
From the command line:
```sh
# to see what this flake exports
nix flake show "github:nrdxp/nixflk"
# run an app
nix run "github:nrdxp/nixflk#someApp"
# start a dev shell for a given derivation
nix develop "github:nrdxp/nixflk#somePackage"
# a nix shell with the package in scope
nix shell "github:nrdxp/nixflk#somePackage"
```
From within a flake:
```nix
{
inputs.nixflk.url = "github:nrdxp/nixflk";
outputs = { self, nixpkgs, nixflk, ... }:
{
nixosConfigurations.example = nixpkgs.lib.nixosSystem {
# ...
modules = [
nixflk.nixosModules.someModule
({
nixpkgs.overlays = [ nixflk.overlay nixflk.overlays.someOverlay ];
})
# ...
];
};
};
}
```
# Setup # Setup
There are many way to get up and running. You can fork this repo or use it as There are a few ways to get up and running. You can fork this repo or use it as
a template. There is a [bare branch][bare] if you want to start with a a template. There is a [bare branch][bare] if you want to start with a
completely empty template and make your own profiles from scratch. completely empty template and make your own profiles from scratch. The only
hard requirement is nix itself. The `shell.nix` will pull in everything else.
You'll need to have NixOS already installed since the `nixos-install` script
doesn't yet support flakes.
## Flake Templates
If you already have [nix-command][nix-command] setup you can: If you already have [nix-command][nix-command] setup you can:
```sh ```sh
# for standard template # for standard template
@ -55,36 +97,42 @@ nix flake new -t "github:nrdxp/nixflk" flk
nix flake new -t "github:nrdxp/nixflk/bare" flk nix flake new -t "github:nrdxp/nixflk/bare" flk
``` ```
However you decide to acquire the repo, once you have it, you'll want to __move ## Nix Only
or symlink__ it to `/etc/nixos` for ease of use. Once inside: Once you have this repo, you'll want to __move or symlink__ it to `/etc/nixos`
for ease of use. Once inside:
```sh ```sh
# This will setup nix-command and pull in the needed tools
nix-shell # or `direnv allow` if you prefer nix-shell # or `direnv allow` if you prefer
```
From here it's up to you. You can deploy the barebones [NixOS](./hosts/NixOS.nix) # quick way to setup your fileSystems (assuming they are partioned):
host and build from there, or you can copy your existing `configuration.nix`. sudo mount /dev/<install-drive> /mnt
You'll probably at least need to setup your `fileSystems` and make sure the nixos-generate-config --root /mnt --show-hardware-config > hosts/yourConfig.nix
[locale](./local/locale.nix) is correct.
Once you're ready to deploy you can use `nixos-rebuild` if your NixOS version # Edit your config to add a bootloader
is recent enough to support flakes, _or_ the [shell.nix](./shell.nix) defines $EDITOR hosts/yourConfig.nix
its own `flk` command in case you need it.
```sh # The following should work fine for EFI systems.
# Usage: flk host {switch|boot|test|iso} # boot.loader.systemd-boot.enable = true;
flk <host-filename> test # boot.loader.efi.canTouchEfiVariables = true;
# Set your locale
$EDITOR local/locale.nix
# install NixOS to bare metal
flk install yourConfig # deploys hosts/yourConfig.nix
# if you already have NixOS and just want to deploy your new setup
flk yourConfig switch
``` ```
## Build an ISO ## Build an ISO
You can make an ISO and customize it by modifying the [niximg](./hosts/niximg.nix)
file:
```sh ```sh
flk iso flk iso
``` ```
You can make an ISO and customize it by modifying the [niximg](./hosts/niximg.nix)
file:
## Use a Package from NUR ## Use a Package from NUR
NUR is wired in from the start. For safety, nothing is added from it by default, NUR is wired in from the start. For safety, nothing is added from it by default,