👷 Swap to simpler Nix flake–based environment

This commit is contained in:
David Pätzel 2023-04-26 15:40:05 +02:00
parent 6e139370a5
commit 5c448dce09
7 changed files with 103 additions and 20 deletions

View File

@ -1,7 +1,7 @@
{ mkDerivation, base, Cabal, extra, monad-loops, MonadRandom
, optparse-applicative, pipes, protolude, QuickCheck
, quickcheck-instances, random, random-fu, random-shuffle, stdenv
, text
{ mkDerivation, base, Cabal, cassava, extra, lib, monad-loops
, MonadRandom, optparse-applicative, pipes, protolude, QuickCheck
, quickcheck-instances, random, random-fu, random-shuffle, text
, wl-pprint-text
}:
mkDerivation {
pname = "haga";
@ -10,15 +10,16 @@ mkDerivation {
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
base extra monad-loops MonadRandom optparse-applicative pipes
protolude QuickCheck quickcheck-instances random random-fu
random-shuffle text
base cassava extra monad-loops MonadRandom optparse-applicative
pipes protolude QuickCheck quickcheck-instances random random-fu
random-shuffle text wl-pprint-text
];
executableHaskellDepends = [
base Cabal extra monad-loops MonadRandom optparse-applicative pipes
protolude QuickCheck quickcheck-instances random random-fu
random-shuffle text
base Cabal cassava extra monad-loops MonadRandom
optparse-applicative pipes protolude QuickCheck
quickcheck-instances random random-fu random-shuffle text
wl-pprint-text
];
description = "Simplistic genetic algorithms library";
license = stdenv.lib.licenses.gpl3;
license = lib.licenses.gpl3Only;
}

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1655624069,
"narHash": "sha256-7g1zwTdp35GMTERnSzZMWJ7PG3QdDE8VOX3WsnOkAtM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0d68d7c857fe301d49cdcd56130e0beea4ecd5aa",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0d68d7c857fe301d49cdcd56130e0beea4ecd5aa",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

24
flake.nix Normal file
View File

@ -0,0 +1,24 @@
{
description = "Flake for haga";
inputs = {
nixpkgs.url =
# 2022-06-22
"github:NixOS/nixpkgs/0d68d7c857fe301d49cdcd56130e0beea4ecd5aa";
};
outputs = inputs@{ self, nixpkgs }:
with import nixpkgs {
system = "x86_64-linux";
}; {
# defaultPackage.${system} = haskellPackages.callPackage ./default.nix { };
devShell.${system} = mkShell {
buildInputs = [
feedgnuplot
haskellPackages.cabal-install
haskellPackages.ormolu
haskell.compiler.ghc8107
];
};
};
}

View File

@ -20,7 +20,8 @@ category: Optimization
build-type: Simple
library
build-depends: base ^>=4.13.0.0
build-depends: base ^>=4.14.0.0
, cassava
, extra
, MonadRandom
, monad-loops
@ -30,9 +31,11 @@ library
, QuickCheck
, quickcheck-instances
, random
, random-fu
-- 0.3.0.0 introduces at least one truly breaking change.
, random-fu <0.3.0.0
, random-shuffle
, text
, wl-pprint-text
default-language: Haskell2010
ghc-options: -Wall -Wno-name-shadowing -Wno-orphans
hs-source-dirs: src
@ -40,9 +43,12 @@ library
, Seminar
, Pretty
, Szenario191
, Szenario202
, Analysis
executable haga
build-depends: base ^>=4.13.0.0
build-depends: base ^>=4.14.0.0
, cassava
, extra
, MonadRandom
, monad-loops
@ -52,9 +58,11 @@ executable haga
, QuickCheck
, quickcheck-instances
, random
, random-fu
-- 0.3.0.0 introduces at least one truly breaking change.
, random-fu <0.3.0.0
, random-shuffle
, text
, wl-pprint-text
default-language: Haskell2010
ghc-options: -Wall -Wno-name-shadowing -Wno-orphans
hs-source-dirs: src
@ -63,9 +71,11 @@ executable haga
, Seminar
, Pretty
, Szenario191
, Szenario202
executable haga-test
build-depends: base ^>=4.13.0.0
build-depends: base ^>=4.14.0.0
, cassava
, Cabal
, extra
, MonadRandom
@ -76,9 +86,11 @@ executable haga-test
, QuickCheck
, quickcheck-instances
, random
, random-fu
-- 0.3.0.0 introduces at least one truly breaking change.
, random-fu <0.3.0.0
, random-shuffle
, text
, wl-pprint-text
default-language: Haskell2010
ghc-options: -Wall -Wno-name-shadowing -Wno-orphans
hs-source-dirs: src

17
haga.md Normal file
View File

@ -0,0 +1,17 @@
# Building
```
nix develop
cabal update
cabal build
```
# Running
```
nix develop
fish run
```

View File

@ -1,11 +1,12 @@
* PROJECT haga
** TODO see TODOs in code
** TODO See TODOs in code
** MAYBE Add factory floor optimizer
GA that optimizes factory floor
- data: graph of workstations with edge weights being the number of walks
between them
- desired: optimal configuration that reduces crossings
- space: 15 workstations that can be positioned in a 20 x 20 space
** MAYBE Implement simple lcs in haga
* Unsorted ideas
- https://github.com/mikeizbicki/HerbiePlugin
- https://github.com/mikeizbicki/subhask

5
run
View File

@ -1,9 +1,10 @@
#! /usr/bin/env nix-shell
#! nix-shell -i fish -p fish feedgnuplot
set exe (fd --type f '^haga$' dist-newstyle/)
"$exe" $argv | \
"$exe" --iterations=10000 $argv | \
# dist-newstyle/build/x86_64-linux/ghc-8.6.5/ga-0.1.0.0/x/ga/build/ga/ga $argv | \
feedgnuplot \
--terminal "x11 background '#ffffff'" \