# nix-configuration Flake based Nix configuration for my machines. ## Useful commands ### General **Show store location of a module** ```shell nix build --print-out-paths --no-link ``` Where `` would be something like `nixpkgs#cowsay` **Run command without installing or nix-shell** ```shell nix run -- ``` Where - `` would be something like `nixpkgs#exa` - `` would be something like `--tree --level 4` (in the case of exa). Note that the `` and `` need to be separated by `--` **Getting a package hash** From URL: ```shell nix run nixpkgs#nix-prefetch fetchurl --url ``` From git/GitHub: ```shell nix run nixpkgs#nix-prefetch-git nix run nixpkgs#nix-prefetch-github ``` This will download the URL/git repository to the store and print the resulting hash. ### Flakes **Switch to a machine configuration by host name** ```shell sudo nixos switch --flake ".#" ``` **Retrieve flake meta data** ```shell nix flake metadata ``` Flake url can be something like - `.` (flake in CWD) - `github:nixos/nixpkgs/nixos-unstable` **Initialize a new flake** ```shell nix flake init --template